Docsity

DATA STRUCTURE AND ALGORITHM PRACTICE, Exams of Data Structures and Algorithms

Toggle sidebar
bg1
DATA STRUCTURE AND
ALGORITHM (REVIEWER FOR
FINAL EXAM)
- Depth First Search (DFS)
- Breadth First Search (BFS) - ANSA tree data structure can be traversed
using?
• A large amount of data can be managed efficiently with ease
• Useful when a particular service is used by multiple consumers
• Fast for data inter-process communication - ANSAdvantages of a Queue
• Array-based Queue
• Linked list-based Queue - ANSImplementations of Queue
• Array-based Stack
• Linked list-based stack - ANSImplementation of Stack
• CPU Scheduling
• Traffic System
• Computer Networks
• Data Buffering - ANSApplications of Queue
• dynamic data structure
• insertion and deletion
pf3
pf4
pf5
pf8
pf9
pfa
pfd
pfe
pff
pf12
pf13
pf14
pf15
pf16
pf17

Partial preview of the text

Download DATA STRUCTURE AND ALGORITHM PRACTICE and more Exams Data Structures and Algorithms in PDF only on Docsity!

DATA STRUCTURE AND

ALGORITHM (REVIEWER FOR

FINAL EXAM)

  • Depth First Search (DFS)
  • Breadth First Search (BFS) - ANSA tree data structure can be traversed using?
  • A large amount of data can be managed efficiently with ease
  • Useful when a particular service is used by multiple consumers
  • Fast for data inter-process communication - ANSAdvantages of a Queue
  • Array-based Queue
  • Linked list-based Queue - ANSImplementations of Queue
  • Array-based Stack
  • Linked list-based stack - ANSImplementation of Stack
  • CPU Scheduling
  • Traffic System
  • Computer Networks
  • Data Buffering - ANSApplications of Queue
  • dynamic data structure
  • insertion and deletion
  • memory efficient - ANSWhat are the advantages of Linked List?
  • Easy to implement using arrays or linked lists, its operations are simple to understand
  • Fast access time for adding and removing elements as the elements are added and removed from the top of the stack only
  • Efficient in function calls as it stores the previous state and efficiently handles recursive function calls
  • Supports backtracking which are used to problem-solving to explore all possible solutions by storing previous states.
  • Used in compiler designs for parsing and syntax analyzing of programming language - ANSAdvantages of a Stack
  • File System
  • Data Compression (e.g. Huffman coding) • Compiler Design (e.g. Syntax tree)
  • Database Indexing (e.g. B-Trees)
  • Storing of possible moves in Chess
  • Storing HTML or DOM object - ANSApplication of Tree Data Structure
  • Fixed-Size Stack
  • Dynamic Size Stack
  • Infix to postfix stack
  • Expression evaluation stack
  • Recursion Stack
  • Memory Management Stack
  • Undo-Redo Stack - ANSWhat are the types of Stack?
  • implementation of stacks and queues
  • Double-EndedQueue(Deque)
  • PriorityQueue - ANSWhat are the different types of Queue?
  • String reversal
  • infix to postfix conversion
  • redo-undo features
  • Used in many algorithms like Tower of Hanoi, tree traversals, stock span problems, and histogram problems
  • Stack Trace - ANSApplications of Stack
  • traversal and reverse traversal are not easy
  • memory usage
  • random access is not possible
  • searching is slower compared to array - ANSWhat are the limitations of Linked List?
  1. C-style array
  2. std::array
  3. std::vector - ANSWhat are the three primary array types?
  4. Fixed-size
  5. Elements are stored in contiguous memory location
  6. insertion and deletion of elements can be problematic - ANSWhat are the limitations of an array?
  7. Information Field
  8. Pointer Field - ANSWhat are the two node structure?
  1. One dimensional arrays 2. Two dimensional arrays
  2. Multi-dimensional arrays - ANSArray can be classified as:
  3. Singly Linked List
  4. Doubly Linked List
  5. Circular Linked List
  6. Doubly Circular Linked List - ANSWhat are the 4 types of Linked List?
  7. storing list of elements belonging to the same data type
  8. auxiliary storage for other data structures
  9. matrices
  10. underlying data structure for implementing stacks and queues - ANSWhat are the applications of an array?
  11. Traversing
  12. Searching
  13. Inserting
  14. Deleting
  15. Sorting
  16. Merging - ANSWhat are the six operations of data structures? Abstract Data Types - ANSThe process of providing only the essentials and hiding the implementation details. (Example: Lists, stacks, queues, and maps) address-of operator (&) - ANSOperator used to obtain the memory address of an object

Array - ANSIt is a linear and homogeneous data structure that collects elements of the same data type and stores them in a contiguous and adjacent memory location. Array length - ANSTotal number of elements Array-based Stack - ANS- The push operation is implemented by incrementing the index of the top element and store the new element to that new top index. -The pop operation is implemented by retrieving the data from the current top element and decrementing the top index. asterisk(*) - ANSOperator used to declare a pointer Attribute - ANSIt represents a particular property of an entity. Binary Tree - ANSIt is a type of tree in which each node can have a maximum of two children linked to it called "left child" and "right child" Breadth First Search (BFS) - ANS- Traversal starts at the root node and visits all nodes at the current level before moving on to the nodes at the next level. It uses a queue to keep track of the child nodes that were encountered but not yet explored. -Also known as Level Order built-in functions - ANSC++ standard library comes with plenty of ________

c-style array - ANSIt is a fixed-size, zero-based indexed collection of elements of the same data type, which inherited from C language. C++ - ANSa superset of the C language that uses object-oriented programming caller, callee - ANSThe function initiating the function call is the ______, and the function being called is the _______ child node - ANSthe immediate successor of a node child nodes - ANSthe nodes below the root node is called _____ Circular Linked List - ANSa singly linked list that in which the last node contains the pointer to the first node Circular Queue - ANSA special type of queue where the last element is connected to the first element of the queue forming a circle. Class - ANSBlueprint of an object Container - ANSIt makes the collections of objects manageable. dangling reference - ANSWhen an object being referenced is destroyed before a reference to it, the reference is left referencing an object that no longer exists. Such a reference is called a _______.

dequeue() - ANS-an operation in order to remove the element at the front of queue -points the front pointer to the next element at front Designated initializers - ANSIt allows you to explicitly define which initialization values map to which members. These are nice because they provide some level of self-documentation and help ensure you don't inadvertently mix up the order of your initialization values. Double-Ended Queue(Deque) - ANSIt is a type of queue where the insertion and removal of elements can be done from either front or rear of the queue. Doubly Circular Linked List - ANSa doubly linked list that in which the last node contains the pointer to the first node Doubly Linked List - ANSa two-way linked list which holds a data and contains a pointer to the next node and a pointer to the previous node Doubly Linked List - ANSWhich type of linked list is used for undo/redo functions? Dynamic data structure - ANSData structures wherein the memory size is not fixed. It can be changed in size during program execution. Dynamic Size Stack - ANSthis stack can grow or shrink dynamically. edge - ANSthe connection between two node

Elementary and Group Item - ANSWhat are the two types of data items? Elementary Item - ANSdata item, which cannot be divided into sub items. (Example: first name, last name, gender) Elements - ANSContainer is a class that provides data storage for a collection of unnamed objects called _______. enqueue() - ANS-an operation to insert an element to the rear of the queue

  • points the rear pointer to the newly-added element Entity - ANSIt represents the class of certain object. Expression evaluation stack - ANSused toevaluate expressions False (Once initialized, reference cannot be changed to reference to another object) - ANSTrue or False: Once a reference is initialized, it can be changed to reference to another object. False (ONLY allowed to READ the value, NOT to MODIFY it) - ANSTrue or False: In pass by const reference, we are allowed to read and modify the value of the object being referenced.

Function - ANSIt is a reusable sequence of statements designed to do a particular job Function call - ANSan expression that tells the CPU to interrupt the current function and execute another function. function parameter - ANSa variable used in the header of a function. Generic Tree / N-ary Tree - ANS- tree that can have any number of nodes Group Item - ANSdata item which can be divided into sub data items. (Example: home address, full name) Head - ANSa pointer that points to the first node in the linked list Height of the Tree - ANSnumber of edges in the tree from the deepest leaf node to root node Heterogeneous data structure - ANSa data structure wherein data types of elements may vary homogeneous data structure - ANSdata structure that contain only similar type of data identical - ANSA reference is essentially ____ to the object being referenced Indexing - ANSAllows fast and direct access to any elements. Formally known as subscript n-

Infix to postfix stack - ANSused to convert infix expressions to postfix expressions information - ANSorganized, analyzed, interpreted data that gives context to data Information field - ANSIt holds the actual data Inserting - ANSthe process of adding a new data item to the given data structure. isEmpty() - ANS-this operation is used before executing a pop() operation isFull() - ANS-this operation validates if the queue is full or not isNull()/ isEmpty() - ANS-this operations checks if the queue is empty Last in-First Out (LIFO) - ANS-A concept that states the element that is inserted last will come out first Leaf node/ External Node - ANSnodes which do not have any child node Level - ANSeach step from top to bottom is called _____

  • root node is at level 0, the root node's children are at level 1, and so on Limited Capacity for fixed size stack (e.g., stack overflow and underflow)

Merging - ANSthe process of combining data items from two same data structure. Missing initializer in a initializer list - ANSall remaining members will be value-initialized if an aggregate is initialized but the number of initialization is fewer than the number of members we can use an empty initialization list to value-initialize all the struct members Multi-dimensional arrays - ANSit requires more than one subscript to specify the number of elements in an array. Nested function - ANSfunction that is not supported by user-defined function Nodes - ANSLinked list forms a series of connected elements also known as _____. Non-Linear data structure - ANSData items are not arranged in sequential order and there is a hierarchical relationship between data items. (Example: trees and graphs) Non-Primitive data structure - ANSThese are derived from primitive data structures. These data structures cannot be operated or manipulated directly by the machine level instructions. It is also responsible for organizing the group of homogeneous and heterogeneous data elements.

One-dimensional arrays - ANSit requires only one subscript to specify the number of elements in an array. overflow - ANSif queue/stack is full, a stack/queue _______ condition occurs parent node - ANSthe predecessor of a node Pass by const reference - ANSIt offers the same primary benefit of avoiding making a copy of the argument, while also guaranteeing that the function cannot change the value being referenced. pass by reference - ANSIt allows us to change the value of an argument without making an expensive copy of an argument when calling a function. pass by value - ANSWhen a function is called, all of the parameters of the function are created as variables, and the value of each of the arguments is copied into the matching parameter (using copy initialization). This process is called _______ Path - ANSthe sequence of nodes and edges from one node to another node Peek() - ANS-an operation in order to acquire the element at the front of the queue without removing it. peek() - ANStop() operation is also known as _____ Pointer - ANSan object that holds a memory address as its value. It allows us to store the address of some other object to use later. Pointer Field - ANSit holds the address of the next node

Record - ANSa collection of field values of a given entity. (Example: profile information of student with ID#12345) Recursion stack - ANSused to keep track of function calls Reference - ANSan allias for an existing object return by value - ANSWhen the return statement is executed, the function exits immediately, and the return value is copied from the function back to the caller. This process is called ___________. return statement - ANSInside the body of the function, we use ___________ to indicate the specific value being returned to the caller. Return type - ANSIt indicates what type of value will be returned. Returning Struct - ANSstructs are usually returned by value to not return dangling reference Ring Buffer - ANSCircular queue is also known as _______ root - ANSthe topmost node of the tree is called _____ -has no parent node

Searching - ANSthe process of finding one or more data items in the given data structure. siblings - ANSchildren of the same parent node Simple Queue - ANSInsertion takes place at the rear and removal takes place at the front. It strictly follows the FIFO (First In First Out) order. Singly Linked List - ANSthe simplest type of linked list in which every node contains a data and a pointer to the next node size() - ANS-this operation returns the size of the stack small, modular chunks - ANSFunctions provide a way for us to split our programs into ___, _____ _______ that are easier to organize, test, maintain, and modify Sorting - ANSthe process of arranging data items on a particular order like ascending or descending. Stack - ANSIt is a linear data structure in which the insertion of a new element and removal of an existing element takes place at the same end. Static data structure - ANSData structure where the amount of data stored (and memory used to store it) is fixed std::array - ANSIt is a fixed-size, static array container introduced in C++11, providing a safer and more feature-rich alternative to traditional C-style arrays.