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
Q

Linked lists can grow or shrink as needed, unlike arrays which have a fixed size.

A

Dynamic Size

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

Add an element to the end of the queue.

A

Enqueue

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

Remove the element from the top of the stack.

A

Pop

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

The basic unit of a linked list that contains data and a pointer to the next node.

A

Node

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

A pointer/reference to the last node in the list (optional).

A

Tail

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

Removing a node from the linked list. This can involve:

A

Deletion

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

Basic Operations on Data Structures ARAU

A

Adding Data: (Create | Insert).
Removing Data:(Delete).
Accessing Data:(Search | Read).
Updating Data: (Update).

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

Like a row of boxes where each box has a number.
-A simple list where each item is stored in a specific order

A

ARRAYS

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

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.

A

LINKED LISTS

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

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).

A

STACKS

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

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).

A

QUEUES

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

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.

A

TREES

37
Q

Like a map showing various points (cities) and connections (roads) between them.
- A network of points connected by lines, showing how items are linked.

A

GRAPHS

38
Q

Like a collection of unique items, no duplicates allowed.
-A collection of unique items with no duplicates.

A

SETS

39
Q

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.

A

MAPS

40
Q

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.

A

POINTER

41
Q

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.

A

DYNAMIC MEMORY ALLOCATION

42
Q

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.

A

DYNAMIC MEMORY ALLOCATION

43
Q

Collection of elements of the same type stored in contiguous memory locations. Arrays allow you to manage multiple variables using a single name.

A

ARRAY

44
Q

User-defined data types that group different types of variables,
allowing for the representation of complex data entities.

A

STRUCTURE

45
Q

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.

A

LINKED LIST

46
Q

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

A

LINKED LIST

47
Q

The basic unit of a linked list that contains data and a pointer to the next node.

A

NODE

48
Q

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

A

HEAD

49
Q

A pointer/reference to the last node in the list (optional).

A

TAIL

50
Q

Adding a new node to the linked list.

A

INSERTION

51
Q

The new node becomes the head of the list.

A

At the beginning

52
Q

The new node is added after the last node.

A

At the end

53
Q

The new node is inserted between two existing nodes.

A

At a specific position

54
Q

Removing a node from the linked list.

A

DELETION

55
Q

The head of the list is removed, and the next node
becomes the new head.

A

Deleting the first node

56
Q

The last node is removed, and the second-to-last
node’s next pointer is set to null.

A

Deleting the last node:

57
Q

A node is removed based on its value or position,
updating the pointers of adjacent nodes accordingly.

A

Deleting a specific node

58
Q

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.

A

TRAVERSAL

59
Q

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.

A

SEARCH

60
Q

Add an element to the top of the stack.

A

PUSH

61
Q

Remove the element from the top of the stack.

A

POP

62
Q

Return the top element without removing it.

A

PEEK

63
Q

Check if the stack is empty.

A

IsEmpty

64
Q

Each node contains data and a pointer to the next node.

A

NODE STRUCTURE

65
Q

Contains a private pointer top and methods for stack operations.

A

STACK CLASS

66
Q

Allow you to view the top element and check if the stack is empty.

A

Peek and isEmpty

67
Q

Add an element to the end of the queue.

A

ENQUEUE

68
Q

Remove the element from the front of the queue.

A

Dequeue

69
Q

Return the front element without removing it.

A

PEEK

70
Q

Contains two pointers (front and rear) to facilitate efficient insertion and deletion.

A

Queue Class

71
Q

process of determining the computational resources required byCan algorithm, focusing primarily on its time complexity and space complexity.

A

Algorithm Analysis

72
Q

is crucial for evaluating algorithm efficiency, helping choose the best solution for a problem.

A

Algorithm Analysis

73
Q

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.

A

TIME COMPLEXITY

74
Q

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.

A

SPACE COMPLEXITY

75
Q

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.

A

Big O notation

76
Q

The algorithm takes the same amount of time regardless of input size.

A

O(1): Constant time

77
Q

The algorithm’s run time increases linearly with the input size.

A

O(n): Linear time

78
Q

The run time grows proportionally to the square of the input size.

A

O(n^2): Quadratic time

79
Q

The algorithm reduces the problem size in each step.

A

O(log n): Logarithmic time

80
Q

To analyze an algorithm: IDU

A
  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
Q

Each node points to the next node.

A

Singly Linked List

82
Q

Each node points to both the next and previous nodes.

A

Doubly Linked List

83
Q

The last node points back to the first node.

A

Circular Linked List

84
Q

Advantages

A

● 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
Q

Disadvantages

A

● 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
Q

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

A

Doubly linked lists

87
Q

The value held by the node.

A

DATA

88
Q

Points to the next node in the list.

A

Next Pointer

89
Q

Points to the previous node in the list.

A

Previous Pointer