MIDTERM REVIEWER Flashcards

1
Q

It is the organization of data.

A

Data Structures

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

Raw, unorganized facts that need to be processed or stored by a computer.

A

Data

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
3
Q
  • Can be displayed in rows, columns, relational databases.
  • Numbers, dates, String
  • Estimated 20% of enterprise data
  • Requires less storage.
  • Easier to manage and protect with legacy solutions.
A

Structured Data

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
4
Q
  • Cannot be displayed in rows, columns, relational databases.
  • Images,audio, video, word processing files, emails, spreadsheets
  • Estimated 80% of enterprise data
  • Requires more storage
  • More difficult to manage and protect with legacy solutions.
A

Unstructured Data

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

Advantage: Quick insertions, very fast access if the index is known.
Disadvantage: Slow search, slow deletions, fixed size

A

Array

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

Advantage: Dynamic size, faster deletion than array, quick insertion.
Disadvantage: Slow search

A

Linked List

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

Advantage: Provide last-in, first out access
Disadvantage: Slow access to other items

A

Stack

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

Advantage: Provide first in, first out access
Disadvantage:Slow Access to other items.

A

Queue

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

Advantage: Quick search, insertion, and deletion ( if tree remains balanced)
Disadvantage: Deletion algorithm is complex

A

Binary Tree

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

Advantage: Fast insertion, deletion, access to largest item.
Disadvantage: Slow access to other items.

A

Heap

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

Advantage: Very fast access if key known, fast insertion.
Disadvantage: Slow deletion, access slow if key not known, inefficient memory usage.

A

Hash Table

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

Advantage: Models real-world situations
Disadvantage: Some algorithms are slow and complex

A

Graph

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
13
Q
  • A step by step procedure on how to solve a problem.
  • Manipulate the data in the data structures in various ways.

Example : Step by step of how to cook a pancit canton.

A

Algorithm

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

Enumerate the Main Data Structure Operations

A
  • Sort
  • Insert
  • Delete
  • Search
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
15
Q

ENUMERATE THE REAL APPLICATIONS OF DATA STRUCTURE

A
  • Real-world data storage
  • Operating Systems
  • Graph Modeling
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
16
Q

Personnel records, inventory records

A

Real-world data storage

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

Stacks and Queues to manage processes and resources

A

Operating Systems

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

Discovering network topologies, Social Network connections.

A

Graph Modeling

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
19
Q
  • A collection of related data and set of rules for organizing and accessing it.
  • An arrangement of data in a computer’s memory or disk.

Example: arrays, linked lists, queues, binary trees, hash tables.

A

Data Structures

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

Manipulate the data in the data structures in various ways.

A

Algorithm

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

Why is it important to learn about data structure?

A

Efficiency: Faster code, less memory use.
Problem-solving: Right tools for the job.
Better code: Easier to read, maintain, and debug.
Job market: Essential for interviews and careers.
Foundation: Building block for other CS concepts

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

How will choosing which data structure to use help in creating efficient programs?

A

Time: Faster operations (search, insert, delete).
Space: Less memory consumption.
Flexibility: Adapt to changes easily.

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

A structure consisting of a fixed number of components with each component of the same type.

A

Arrays

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

Enumerate the Array Components

A
  • Name;
  • Data/ Component type;
  • Indices of first and last component
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
25
Enumerate the Types of Arrays
- One- Dimensional Arrays - Multidimensional Array - Jagged Array
26
- Store a number of items with a pre-defined data type. - For practical purposes, so that the computer will know if it can fit inside the memory - All items are stored contiguous starting from 0 to the size of the array - Known as Single- Dimensional Arrays
One- Dimensional Arrays
27
- Known as rectangular array - An array with more than one dimension - The form of a multi-dimensional array is a matrix
Multidimensional Array
28
- Arrays of arrays - The elements of a jagged array are other arrays.
Jagged Array
29
What are Array Operations?
- Insert - Delete
30
A new item is always inserted in the first vacant cell in the array
Insert
31
The item to be deleted must first be found
Delete
32
What are the types of search?
- Linear / Sequential search - Binary search
33
- Your going to look of each cell after another - Looks at every single index value in the entire array - If there are duplicates, linear search works better when you want to find all matches. - If there are no duplicates, a binary search is better.
Linear / Sequential search
34
When will the sequential search end? What are the two scenarios?
- If the element is found - when the end of the array is reached
35
- The data is "halved" at each step of the execution. - Used in the age guessing game, “Higher or Lower” - in order the search to work, the array must be sorted first, before searching can happen. - work if the array is sorted first if it's an unsorted array the binary search will not work. - more faster compared to linear search
Binary Search
36
In Data Structure, how are we going to measure the time and space complexity of a particular algorithm, what unit?
We use the big (O) notation
37
Enumerate the Types of Data Structures
- Built-in Data Structures - User Defined Data Structures
38
Why is there’s no String in the Built-in Data Structures?
- Because String is **made up of characters.** The native data structure is characters and it just combined to create a string -String is an array of characters.
39
ENUMERATE THE CHARACTERISTICS OF A DATA STRUCTURE
- Linear - Non- Linear - Homogenous - Non - Homogenous - Static - Dynamic
40
The data items are arranged in a linear sequence. Example: Array
Linear
41
the data items are not in sequence. Example: Tree, Graph
Non-Linear
42
all the elements are of the same type. Example: Array
homogeneous
43
the elements may or may not be of the same type. Example: Structures
non-Homogeneous
44
those whose sizes and structures associated memory locations are fixed, at compile time. Example: Array
Static
45
those that expand or shrink depending upon the program need and its execution. Also, their associated memory locations change. Example: Linked List created using pointers
Dynamic
46
-Used for us to manipulate the user-defined data structures - is a finite set of instructions or logic, written in order, to accomplish a certain predefined task. - The _________ is not the complete code or program, it is just the core logic(solution) of a problem, which can be expressed either as an informal high-level description as pseudocode or using a flowchart.
Algorithm
47
Every Algorithm must satisfy the following properties?
1. Input 2. Output 3. Definiteness 4. Finiteness 5. Correctness
48
- There should be 0 (zero) or more inputs supplied externally to the algorithm. - Not required
1. Input
49
- There should be at least 1 output obtained. - required
Output
50
Every step of the algorithm should be clear and well defined.
Definiteness
51
The algorithm should have a finite number of steps.
Finiteness
52
Every step of the algorithm must generate the correct output
Correctness
53
**True or False** An algorithm is said to be efficient and fast if it takes less time to execute and consumes less memory space.
True
54
The performance of an algorithm is measured on the basis on the following properties:
-Space Complexity - Time Complexity
55
- The concept that is overlooked most of the time - Because the majority of us developers are thinking, "Hmm, I probably won't need to know that while I actually code!"
Complexity Analysis
56
- deals with comparing algorithms based on the number of computing resources that each algorithm uses. Usually, resources are time and memory - being able to make an informed decision about which algorithm is a winner in terms of making efficient use of resources (time or memory, depending upon use case).
Algorithm analysis
57
- Deals with the use of the memory space of a particular algorithm. For **instance, program instructions, variables execution.** - Whenever a solution to a problem is written some memory is required to complete it.
Space Complexity of Algorithms
58
Algorithm uses memory space for three reasons which is?
1. Instruction Space 2. Environmental Stack 3. Data Space
59
- Code or executable that needs to be stored in the machine - It's the amount of memory used to save the compiled version of instructions
1. Instruction Space
60
- Executable to run - Sometimes an algorithm (function) may be called inside another algorithm(function). In such a situation, the current variables are pushed onto the system stack, where they wait for further execution and then the call to the inside algorithm(function) is made - For example, If a function A() calls function B() inside it, then all the variables of the function A() will get stored on the system stack temporarily, while the function B() is called and executed inside the function A().
2. Environmental Stack
61
-Amount of space used by the variables and constants. - Can be modified
Data Space
62
Which one has the better approach? **Algorithm 1** Int getSquare(int n) { Int square; for (int i = 1; i < = n; 1++) { square = square + n; } return square; } **Algorithm 2** Int getSquare(int n) { return (n* n); }
Algo 2, because it just multiplies the n*n and it will return already
63
This calculating where we need to know the value of memory used by a different type of datatype variables, which generally varies for different operating systems, but the method for calculating the __________________ remains the same
Calculating the space complexity
64
What are the size of this? Bool, char, unsigned char, signed char
1 byte
65
What are the size of this? Short, unsigned short
2 byte
66
What are the size of this? Float, int , unsigned int, long, unsigned long
4 byte
67
What are the size of this? - Double, long double, long long
8 byte
68
- an algorithm signifies the **total times required by the program to run till its comparison** - Most commonly expressed using the big O notation. - Most commonly estimated by counting the numbers of **elementary steps performed by any algorithm to finish execution** -Elementary steps mean the basic steps of the particular algorithm
Time complexity
69
- the most common metric for calculating time complexity. - This removes all constant factors so that the running time can be estimated in relation to N. as N approaches infinity.
Big O notation
70
ENUMERATE THE TYPES OF TIME COMPLEXITY
Linear Time - O(n) Constant Time -O(1) Quadratic Time -O(n²)
71
N is depending on the input or the time it will take will depend on the input
Linear Time - O(n)
72
- Whatever the input is the time it takes for the algorithm to finish its functionality will remain constant. - Whatever the size of input will not matter
Constant Time -O(1)
73
The time it takes will be depending on the depending on the input squared
Quadratic Time -O(n²)