Algorithms and Programming University of the Cordilleras Data
- Slides: 40
Algorithms and Programming University of the Cordilleras
Data Structures Constant Variable Name Value Data Type Lifetime Scope Record File
Integer Simple Type Basic Data Structure Type Abstract Data Type Data Structure List Structure Stack Problem. Oriented Data Structure Queue Tree Structure Hash Real Number Pointer Type Character Arrays Enumeration Record Logical Partial
Arrays and Lists Row Major Column Major Garbage Collection and Memory Allocations
Lists Connected by pointers Root A B Data Part C Pointer Part D x
Root A B x C x B’ Root A B x C x D x
Stacks and Queues Top and Bottom Head and Tail Push and Pop Enqueue and Dequeue
Trees Root Nodes Edges Parent and Child Leaf Subtree Depth
Binary Trees Complete Binary Trees Binary Search Trees Pre Order, In Order and Post Order
Hashing Standard Table vs. Hashed Table Division Method Registration Method Base Conversion Method Chain Method (Open Hash Method) Open Address Method (Closed Hash Method)
Algorithms Input Output Finiteness Definiteness Effectiveness
Flowchart Symbols
Control Structures Sequence Structure Selection Structure Repetition Structure
Sorting Algorithms Bubble Sort Selection Sort Insertion Sort Merge Sort Shell Sort Quick Sort // find lowest/highest element // find element // gap // pivot
Recursions ƒn-1 + ƒn-2 if n > 1 ƒn = 1 0 if n = 1 if n = 0
Generation Language 1 GL Machine Language 2 GL Assembly Language 3 GL High Level PL 4 GL pseudo-English Language used to access databases 5 GL used for AI and neural networks
Programming Language Paradigms Procedural Functional Logic Object Oriented
Language Processors Compilers vs Interpreters
Markup Languages HTML based on SGML (Standard Generalized ML) text format used to simplify data conversion for e-publishing, text db, and other types of apps DHTML (Dynamic HTML) XML defines DTD (document type definition) separately VRML Virtual Reality Modeling Language language used to manipulate 3 D data
Natural and Formal Languages BNF (Backus-Naur Form) Sequence <x>: : =<a><b> Repetition <x>: : =<a>… OR <x>: : =<a+> OR <x>: : =<a*> Selection <x>: : =<a|b> Optional <x>: : =[<a>]
Terminating and Non-Terminating Symbols <y>: : =<a><x> <x>: : =<b><c>
<floating point constant>: : = [<sign>]<radix constant>[<exponent>] | [<sign>]<numeric string><exponent> <radix constant>: : = [<numeric string>]<. ><numeric string> <exponent>: : = <E>[<sign>]<numeric string>: : = <numeral>| <numeric string><numeral>: : =0|1|2|3|4|5|6|7|8|9 <sign>: : =+|-
ü Data Structures and Algorithms Quiz ü With BNF ü And Sets
1. A list of four numbers (4, 1, 3, 2) was re-ordered in ascending order in accordance with a sorting algorithm. The numbers were re-ordered as shown below. Which of the following is the sorting algorithm? (1, 4, 3, 2) (1, 3, 4, 2) (1, 2, 3, 4) a. b. c. d. Quick Sort Selection Sort Insertion Sort Bubble Sort
2. There are 2 data structures using Queue and Stack. What value will be stored after the following process? push(a) push(b) enq(pop()) enq(c) push(deq()) x pop() a. b. c. d. a b c d
3. There is a four-digit number N 1 N 2 N 3 C that is used for Customer Account Number (CAN). The rightmost digit “C” can be calculated as follows: C = (N 1* 3 + N 2* 5 + N 3* 7) mod 10 Which of the following is a correct CAN? Here, x mod y returns the remainder when x is divided by y. 3. 4. 5. 6. 7714 7715 9690 9695
4. The following function ƒ(n, k) exists: 1 (k=0) ƒ(n, k) = ƒ(n-1, k-1) + ƒ(n-1, k) (0<k<n) 1 (k=n) What is the value of (4, 2)? 4. 5. 6. 7. 3 4 5 6
5. When a list of 7 elements shown below is arranged in ascending order, which of the following sorting algorithms is completed with the minimum number of element exchanges? 3, 5, 12, 9, 10, 7, 15 a. b. c. d. Bubble Sort Insertion Sort Merge Sort Shell Sort
6. Which of the following equations holds well in the postfix notation (or Reverse Polish Notation)? Here, x, y, and z are variables. a. b. 6. a. x y + z- = x y z + x y - z+ = x y z - x y - z- = x y z - -
7. In some circumstances, a program may be still running when it is called again by another program. Which of the following is the appropriate characteristic that should be implemented to execute this program correctly? a. b. c. d. Recursive Reentrant Relocatable Reusable
8. Which of the following is the appropriate combination of basic concepts of object-oriented approach? a. b. c. d. Abstraction, encapsulation, inheritance, and class Instantiation, Structuralization, sequence, and class Normalization, encapsulation, division, and class Virtualization, Structuralization, projection, and class
9. When the results of the logical operation “x # y” are shown in the table below, which of the following expressions is equivalent to the operation “x # y”? Here, “AND” is used for the logical product, “OR” is for the logical sum, and “NOT” is for the logical negation. 9. 10. 11. 12. x AND (NOT y) x OR (NOT y) (NOT x) AND (NOT y) (NOT x) OR (NOT y)
10. The formula shown below is represented in postfix (or reverse Polish) notation. Which of following is the resulting value of this formula? 51– 3*31– 2*/ a. 1 b. 3 c. 5 d. 7
11. There are two important operations on a stack: PUSH and POP. PUSH adds the new data to the top of the stack leaving previous data below, and POP removes and returns the current top data of the stack. When the operations shown below are sequentially executed, which of the following is the correct combination of the values x and y? Here, the size of the stack is big enough to hold the entire data. “PUSH(a)” inserts the data a into the stack, and “POP(b)” removes the data b from the stack. ü [Operations] a. x = 1; y=6; ü PUSH (5); b. x = 1; y=7; ü PUSH (3); c. x = 5; y=3; ü PUSH (6); d. x = 5; y=7; ü PUSH (1); ü x = POP ( ); ü PUSH (7); ü y = POP ( );
12. a A binary search tree is created by inserting the values shown below. 7 9 11 2 8 10 5 3 After deletion of the root from the newly created tree, what does it look like?
13. Which of the following represents the sequence of nodes visited in a post-order traversal of the binary tree T shown below? a) U Q X W P V Z Y c) U X Z Q W Y V P b) U X W Q Z Y V P d) X Z U W Y Q V P
14. A recursive definition of a factorial function f (n) that calculates “n! ” can be represented as follows: Which of the following combinations should be inserted in the boxes A and B? Here, “n” is a non-negative integer. a
15. According to a survey of 100 students, there are 40 students studying English, 30 studying French, and 25 studying Spanish. In addition, 8 students are studying English and French, 6 are studying English and Spanish, 5 are studying French and Spanish, and 22 are not studying any of the three languages. Which of the following is the number of students studying all three languages? a) 1 c) 3 b) 2 d) 4
Bonus. A search is performed by specifying a character string comprised of multiple alphabetic characters and one delimiter character “. ” (period). An “*” (asterisk) represents an arbitrary character string with zero or more characters, and a “? ” (question mark) represents an arbitrary single character. Which of the following character strings matches the character string represented below? X*. Y? ? a) b) c) d) XY. XYY XXX. YY XYX. YXYX. YXY
- Mapa físico de colombia con sus cordilleras
- Cordilleras pericontinentales
- Sativa originaria de las cordilleras del himalaya
- Imagen del relieve de colombia
- Cordilleras exteriores a la meseta
- Computational thinking algorithms and programming
- Synchronization algorithms and concurrent programming
- Game programming algorithms and techniques
- Data structures and algorithms iit bombay
- Princeton data structures and algorithms
- Data structures and algorithms tutorial
- Information retrieval data structures and algorithms
- Data structures and algorithms bits pilani
- Ajit diwan iitb
- Data structures and algorithms
- Data structures and algorithms
- Ian munro waterloo
- Signature file structure in information retrieval system
- Data structures and algorithms
- Stream data model
- Algorithms + data structures = programs
- Perbedaan linear programming dan integer programming
- Greedy programming vs dynamic programming
- System programming
- Linear vs integer programming
- Definisi integer
- Hình ảnh bộ gõ cơ thể búng tay
- Ng-html
- Bổ thể
- Tỉ lệ cơ thể trẻ em
- Chó sói
- Thang điểm glasgow
- Chúa yêu trần thế alleluia
- Môn thể thao bắt đầu bằng chữ đua
- Thế nào là hệ số cao nhất
- Các châu lục và đại dương trên thế giới
- Công của trọng lực
- Trời xanh đây là của chúng ta thể thơ
- Mật thư anh em như thể tay chân
- Làm thế nào để 102-1=99
- độ dài liên kết