pROG Flashcards

1
Q

What does a pointer store?

A

Address of a variable

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
2
Q

Which operator is used to access the value stored at the memory address held by a pointer?

A

*

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
3
Q

What is the correct way to declare a pointer to an integer?

A

int pointer;

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
4
Q

Which keyword is used to free dynamically allocated memory?

A

delete

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
5
Q

Which of the following is a correct way to declare an array of 10 integers?

A

int arr[10];

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
6
Q

Are dynamic data structures that provide flexibility and efficient operations compared to static arrays

A

Linked List

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
7
Q

Check if the stack is empty.

A

IsEmpty

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
8
Q

A pointer can point to any data type.

A

True

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
9
Q

An array in C++ can store different types of data in the same array.

A

FALSE

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
10
Q

When dynamically allocating an array, you must free the memory using delete[].

A

True

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
11
Q

Is used to retrieve the address of a variable.

A

The address-of operator (&)

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
12
Q

Which of the following is the correct way to define a structure?

A

struct myStruct{ int x; float y; };

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
13
Q

Points to the next node in the list

A

Next Pointer

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
14
Q

Visiting each node in the linked list, usually to read or process the data stored in each node.

A

Traversal

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
15
Q

Remove the element from the front of the queue.

A

Dequeue

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
16
Q

Finding a node in the linked list that contains a specific value.

A

Search

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
17
Q

Enhance traversal capabilities, allowing for easy movement in both directions.

A

Doubly Linked List

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
18
Q

The value held by the node.

A

Data

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
19
Q

Adding a new node to the linked list. This can be done at various positions:

A

Insertion

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
20
Q

Add an element to the top of the stack.

A

Push

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
21
Q

Points to the previous node in the list.

A

Previous Pointer

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
22
Q

Return the front element without removing it.

A

Peek

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
23
Q

A pointer/reference to the first node in the list.

A

Head

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
24
Q

Return the top element without removing it.

A

Peek

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
25
Linked lists can grow or shrink as needed, unlike arrays which have a fixed size.
Dynamic Size
26
Add an element to the end of the queue.
Enqueue
27
 Remove the element from the top of the stack.
Pop 
28
 The basic unit of a linked list that contains data and a pointer to the next node.
Node
29
A pointer/reference to the last node in the list (optional).
Tail
30
 Removing a node from the linked list. This can involve:
Deletion
31
Basic Operations on Data Structures  ARAU
Adding Data: (Create | Insert). Removing Data:(Delete). Accessing Data:(Search | Read). Updating Data: (Update).
32
Like a row of boxes where each box has a number. -A simple list where each item is stored in a specific order
ARRAYS
33
Like a chain of linked rings, where each ring points to the next one.  - A list where each item points to the next one in line.
LINKED LISTS
34
Like a stack of plates where you add and remove from the top. -A collection where the last item added is the first one to be removed (Last In, First Out - LIFO). 
STACKS
35
Like a line at a checkout where the first person in line is the first one served. -A collection where the first item added is the first one to be removed (First In, First Out - FIFO). 
QUEUES
36
Like an upside-down family tree showing relationships between items.  -A structure that resembles an upside-down tree, with a root and branches showing how items are related. 
TREES
37
Like a map showing various points (cities) and connections (roads) between them.  - A network of points connected by lines, showing how items are linked. 
GRAPHS
38
Like a collection of unique items, no duplicates allowed. -A collection of unique items with no duplicates. 
SETS
39
Like a real-world dictionary where you look up words (keys) to find their definitions (values). -A collection of key-value pairs where each key is unique and maps to a specific value. 
MAPS
40
is a variable that stores the memory address of another variable. Hold the location where data is stored in memory.  -Variables that store memory addresses, allowing for efficient data manipulation and memory management.
POINTER
41
allows programs to request memory at runtime, rather than at compile time. This is useful when the amount of memory needed isn't known beforehand.
DYNAMIC MEMORY ALLOCATION
42
Techniques (new and delete) to allocate and deallocate memory at runtime, providing flexibility in handling data structures whose size isn't known at compile time.
DYNAMIC MEMORY ALLOCATION
43
Collection of elements of the same type stored in contiguous memory locations. Arrays allow you to manage multiple variables using a single name.
ARRAY
44
User-defined data types that group different types of variables, allowing for the representation of complex data entities.
STRUCTURE
45
data structure that consists of a sequence of elements, where each element points to the next element in the sequence. Unlike arrays, linked lists do not require contiguous memory locations, allowing for efficient memory usage and dynamic sizing.
LINKED LIST
46
Are dynamic data structures that provide flexibility and efficient operations compared to static arrays.
LINKED LIST
47
The basic unit of a linked list that contains data and a pointer to the next node.
NODE
48
A pointer/reference to the first node in the list.
HEAD
49
A pointer/reference to the last node in the list (optional).
TAIL
50
Adding a new node to the linked list.
INSERTION
51
The new node becomes the head of the list.
At the beginning
52
The new node is added after the last node.
At the end
53
The new node is inserted between two existing nodes.
At a specific position
54
Removing a node from the linked list.
DELETION
55
The head of the list is removed, and the next node becomes the new head.
Deleting the first node
56
The last node is removed, and the second-to-last node's next pointer is set to null.
Deleting the last node:
57
A node is removed based on its value or position, updating the pointers of adjacent nodes accordingly.
Deleting a specific node
58
Visiting each node in the linked list, usually to read or process the data stored in each node. This is typically done starting from the head and moving through each node using the next pointers until the end of the list is reached.
TRAVERSAL
59
Finding a node in the linked list that contains a specific value. This operation involves traversing the list and checking each node's value until the desired value is found or the end of the list is reached.
SEARCH
60
Add an element to the top of the stack.
PUSH
61
Remove the element from the top of the stack.
POP
62
Return the top element without removing it.
PEEK
63
Check if the stack is empty.
IsEmpty
64
Each node contains data and a pointer to the next node.
NODE STRUCTURE
65
Contains a private pointer top and methods for stack operations.
STACK CLASS
66
Allow you to view the top element and check if the stack is empty.
Peek and isEmpty
67
Add an element to the end of the queue.
ENQUEUE
68
Remove the element from the front of the queue.
Dequeue
69
Return the front element without removing it.
PEEK
70
Contains two pointers (front and rear) to facilitate efficient insertion and deletion.
Queue Class
71
process of determining the computational resources required byCan algorithm, focusing primarily on its time complexity and space complexity.
Algorithm Analysis
72
is crucial for evaluating algorithm efficiency, helping choose the best solution for a problem.
Algorithm Analysis
73
measures the amount of time an algorithm takes to complete as a function of the length of the input. -Understanding time complexity allows us to predict the performance of an algorithm.
TIME COMPLEXITY
74
measures the total amount of memory space required by the algorithm, including both the input and auxiliary space. - space complexity helps developers understand the resource requirements of an algorithm, which is essential in environments with limited memory.
SPACE COMPLEXITY
75
describes the upper bound of an algorithm's time or space complexity. It provides a high-level understanding of the efficiency of an algorithm without getting bogged down in implementation details.
Big O notation
76
The algorithm takes the same amount of time regardless of input size.
O(1): Constant time
77
The algorithm's run time increases linearly with the input size.
O(n): Linear time
78
The run time grows proportionally to the square of the input size.
O(n^2): Quadratic time
79
The algorithm reduces the problem size in each step.
O(log n): Logarithmic time
80
To analyze an algorithm: IDU
1. Identify the input size. 2. Determine the operations performed by the algorithm. 3. Use Big O notation to express the time and space complexities.
81
Each node points to the next node.
Singly Linked List
82
Each node points to both the next and previous nodes.
Doubly Linked List
83
The last node points back to the first node.
Circular Linked List
84
Advantages
● Dynamic Size: Linked lists can grow or shrink as needed, unlike arrays which have a fixed size. ● Efficient Insertions/Deletions: Adding or removing elements is easier and more efficient, especially at the beginning or middle of the list.
85
Disadvantages
● No Random Access: Unlike arrays, linked lists do not allow direct access to elements; they must be accessed sequentially. ● Extra Memory Overhead: Each node requires additional memory for storing pointers.
86
enhance traversal capabilities, allowing for easy movement in both directions.
Doubly linked lists
87
The value held by the node.
DATA
88
Points to the next node in the list.
Next Pointer
89
Points to the previous node in the list.
Previous Pointer