Data Structure and Algorithms (Midterm Reviewer)

studied byStudied by 16 people
0.0(0)
get a hint
hint

C++

1 / 92

Tags and Description

SCOPE Introduction to C++ Selection Structure for Loop Introduction to Data Structures and Algorithms Arrays Functions Structures

93 Terms

1

C++

a good foundation of learning other programming languages like Java, Python, etc.

New cards
2

Bjarne Stroustrup

C++ general-purpose programming language developed by__________as an extension of the C language.

New cards
3

int main()

entrypoint of the program. The codes in main will be executed.

New cards
4

return 0;

exit status of the application. If 0 is the exit status, the program worked fine until the end, without errors.

New cards
5

cout<<

is used for printing a certain text or number. To use, the header file must be included

New cards
6

<<insertion operator

That sends the text or value in the console to be printed.

New cards
7

Data Structure

a way of arranging data on a computer so that it can be accessed and updated efficiently

New cards
8

Escape Sequences

are special characters characterized by a backslash (\) and a letter or symbol beside it

New cards
9

Escape Sequences

used in cout statements to show spaces, new lines, or show symbols that cannot be outputted using the normal way of printing

New cards
10

New Line

Moves the cursor to the beginning of the next line.

New cards
11

/n

What is new line symbol?

New cards
12

Tab

Inserts a horizontal tab.

New cards
13

\t

What is tab symbol?

New cards
14

Pre defined and user defined functions

Function two Types are ___________, ____________?

New cards
15

Function Declaration

Function Definition

Function Call

The Three Function Aspects are?

New cards
16

\\

What is symbol of backlash character?

New cards
17

Variables

they act as containers or buckets where the data will be put into and stored

objects that are used to store values

New cards
18

Variable

A___________ data type remains as it is once declared, so when you try to assign a letter to an integer variable, the character value will be converted into its integer equivalent.

New cards
19

- American Standard Code for Information Interchange

What is the meaning of ASCII?

New cards
20

65

ASCII of “A”

New cards
21

97

ASCII of “a”

New cards
22

48

ASCII of “o”

New cards
23

cin>>

allows the user to type in the data asked by the program. works if the iostream header file is included.

New cards
24

>> extraction operator

that reads the input from the keyboard

New cards
25

Algorithm

a set of well-defined instructions to solve a particular problem it takes a set of input(s) and produces the desired output.

New cards
26

Good Quality Program

precisely defined input and output

clear and unambiguous steps

most effective in solving problems

not written in computer code

usable in any programming language

New cards
27

Data Structures

a storage that is used to store and organize data

a way of arranging data on a computer so that it can be accessed and updated efficiently

New cards
28

Linear Data Structures

elements are arranged in sequence one after the other, making it easy to implement.

New cards
29

Linear Data Structures

Examples: arrays, stacks, queues, linked lists

New cards
30

Nonlinear Data Structures

Elements are not in any sequence. They are arranged in a hierarchical manner where one element will be connected to one or more elements.

New cards
31

Nonlinear Data Structures

Examples: graphs and trees

New cards
32

Data Structure

are used to hold data

New cards
33

Algorithm

used to solve the problem using that data.

New cards
34

Arrays

It is an ordered collection of values of the same type.

Elements can be accessed via its index (address, location).

All arrays consist of contiguous memory locations.

New cards
35

One-dimensional Arrays

It is made up of one row or one column of array members with the same name but different index values

New cards
36

2D Array

is the most basic type of multi-dimensional array.

New cards
37

Outer Loop, Inner Loop

Using for loop to access all elements of the 2D array. The ________ is for the rows, the________ is for the columns.

New cards
38

Functions

Container for a few lines of code to accomplish a specific task

Set of programming statements enclosed in { and }

New cards
39

Functions

For reusability and modularity, they can be called numerous times.

New cards
40

Pre-defined Functions.

Built into the language to perform operations. It is stored in Standard Function Library.

New cards
41

User-defined Functions.

Defined by the user to perform specific tasks.

New cards
42

Function Declaration

tells the compiler about a function name and how to call the function.

New cards
43

Function Definition

contains the actual statements which are to be executed

New cards
44

Function Call

performs the defined tasks

New cards
45

Actual Parameters or arguments

are values which are passed in the function call.

New cards
46

Formal Parameters

are variables local to that function and cannot be used in other parts of the program,

New cards
47

return Keyword

Terminates the function and returns the value.

New cards
48

-Define the function’s return data type

-Use the return keyword inside the function body.

Two things are required to return a value to the caller:

New cards
49

void Keyword

It is defined before the function name.

The call to the void function is a standalone statement.

Void functions don’t need to have the return statement

New cards
50

Recursive Functions

A function whose definition contains a call to itself.

New cards
51

TAIL RECURSION

• The function calls itself as the final statement of the function.

• When it is called, it must process or carry out some action.

• It does nothing after that call.

New cards
52

HEAD RECURSION

• The initial statement of a recursive function is also the first time it calls itself.

• At the time of calling, is not required to process anything.

• Everything is completed when the method returns.

New cards
53

LOCAL VARIABLES

Only statements that are inside that function or block of code can use them.

• They are not known to functions outside their own.

New cards
54

GLOBAL VARIABLES

• Their values are maintained throughout the life of your program.

• It may be accessed from any of the program’s functions.

New cards
55

Base case, Recursive case

A recursion has two parts:

New cards
56

Base Case

Or the halting case. It is the indication of when the recursion will stop.

New cards
57

Recursive Case.

It is the recursive call with a different input that progressively gets closer to the base case.

New cards
58

Structures

A collection of different data types under a single name.

Used to express data about anything that is more complex than what can be represented by a single integer, character, or Boolean.

New cards
59

Importance of Structure

-compile multiple pieces of information on a single topic in one location

-collect data of the same data kinds and parameters incredibly simple to maintain

-aggregating together related data in one entity through the struct keyword allows programs to construct user-defined types.

New cards
60

Syntax and Implementation

Structures are declared by starting with the struct keyword then the structure name (identifier).

Inside the curly braces are the member variables with different data types.

New cards
61

Accessing Elements

Use the dot [.] operator to access the inner variables of the structure

New cards
62

Typedef

is a keyword used to specify alternative names for primitive types.

New cards
63

typedef struct,

With the application of ____________ variable declaration no longer needs the keyword struct.

New cards
64

True

True or False | The main method is the entrypoint of the program

New cards
65

std::cout

statements to show spaces, new lines, or show symbols that cannot be outputted using the normal way of printing.

New cards
66

#include<iomanip>

to be able to use std::setprecision, defines the manipulator functions that are used to manipulate the format of the input and output of our program. It is a part of the input/output library in C++.

New cards
67

std::cout << std::fixed;

this is needed to change the default formatting of the numbers that are printed to "fixed-point notation".

New cards
68

std::setprecision(3)

- this is the line that sets the number of decimal places to be printed.

New cards
69

Namespace

cout is part of the standard library, and all the elements in the standard C++ library are declared within what is called a ____________

New cards
70

Character

A letter, symbol, or white space). This should be enclosed in single quotes.

New cards
71

Integer

Whole numbers ranging between ±32767.

New cards
72

Floating Point Values

Real numbers that can handle up to 7 decimals. To indicate

that it is float, you should add an f at the end of the value.

New cards
73

Double Floating Point Values

Real numbers that can handle up to 15 decimals

Double is just the same as a

Float but can hold larger

numbers.

New cards
74

Boolean

Truth values (true/false).

New cards
75

Constant variables

are special type of variables whose values can't be changed.

New cards
76

const data_type CONSTANT_NAME = value;

Declaring a constant variable using that follows this

syntax:

New cards
77

Uppercase letters

The naming of constants are usually in____________ to easily identify that the variable is indeed a constant.

New cards
78

Comments

in your code will not be executed because they serve as guide to the programmers, which makes it very useful especially when making a project with lots of lines of codes.

New cards
79

Flat Case

All words are in lowercase but connected directly.

New cards
80

Camel Case

Uncapitalized first word, capitalized proceeding words (like a camel shape) and connected directly.

New cards
81

Pascal Case

All words are capitalized and connected directly.

New cards
82

Snake Case

All words are in lowercase and connected by an underscore (_).

New cards
83

Macro Case

All words are in uppercase and connected by an underscore (_).

This casing is often used in constants.

New cards
84

Overriding Shortcuts

There are instances when we wish to perform calculations on the value of a variable and then overwrite the value of the variable by the result it garnered.

New cards
85

pow ( )

Returns the value of the left operand

(base) raised to the power of the right

operand (exponent).

New cards
86

sqrt ( )

Returns the square root of a number.

New cards
87

floor ( )

Rounds down a number to the largest

integer less than or equal to the number.

New cards
88

ceil ( )

The opposite of floor. Rounds up the

number to the smallest integer greater

than or equal to the number

New cards
89

fabs ( )

Returns the absolute, positive value of num.

New cards
90

Data Structure

-a storage that is used to store and organize data

. It is a way of arranging data on a computer so that it can

be accessed and updated efficiently

New cards
91

Graphs

Example of Non-Linear Data Structure that each node is called vertex, and each vertex is connected to other vertices through edges.

New cards
92

Trees

Example of Non-Linear Data Structure also a collection of vertices and edges. But there can only be one edge between two vertices.

New cards
93

ARRAY TRAVERSAL

-Used for visiting, accessing, and printing each element of an array exactly once

• It is necessary to create a variable that will track the position of the element that is currently being accessed

New cards

Explore top notes

note Note
studied byStudied by 13 people
Updated ... ago
5.0 Stars(1)
note Note
studied byStudied by 8 people
Updated ... ago
5.0 Stars(1)
note Note
studied byStudied by 5 people
Updated ... ago
5.0 Stars(1)
note Note
studied byStudied by 17 people
Updated ... ago
4.5 Stars(2)
note Note
studied byStudied by 6 people
Updated ... ago
5.0 Stars(1)
note Note
studied byStudied by 11 people
Updated ... ago
5.0 Stars(2)
note Note
studied byStudied by 4 people
Updated ... ago
5.0 Stars(1)
note Note
studied byStudied by 18 people
Updated ... ago
4.5 Stars(2)

Explore top flashcards

flashcards Flashcard187 terms
studied byStudied by 24 people
Updated ... ago
4.0 Stars(1)
flashcards Flashcard59 terms
studied byStudied by 16 people
Updated ... ago
5.0 Stars(1)
flashcards Flashcard65 terms
studied byStudied by 22 people
Updated ... ago
5.0 Stars(1)
flashcards Flashcard53 terms
studied byStudied by 26 people
Updated ... ago
5.0 Stars(1)
flashcards Flashcard105 terms
studied byStudied by 13 people
Updated ... ago
5.0 Stars(1)
flashcards Flashcard53 terms
studied byStudied by 39 people
Updated ... ago
5.0 Stars(1)
flashcards Flashcard103 terms
studied byStudied by 31 people
Updated ... ago
5.0 Stars(1)
flashcards Flashcard44 terms
studied byStudied by 45 people
Updated ... ago
5.0 Stars(1)