{[ promptMessage ]}

Bookmark it

{[ promptMessage ]}

Algorithms_and_Data_Structures_09

# Algorithms_and_Data_Structures_09 - Lecture 9 Computer...

This preview shows pages 1–13. Sign up to view the full content.

Computer Science Algorithms and Data Structures Prof. Dr. Andreas Nüchter Research I, Room 105 Jacobs University Bremen http://www.nuechti.de [email protected] Lecture 9

This preview has intentionally blurred sections. Sign up to view the full version.

View Full Document
Algorithms and Data Structures Dr. Andreas Nüchter October 1, 2009 299 Announcements (1) Midterm October 15 14:15-15:30 Remember grading policy: Assignments: 20% of the final grade Midterm: 30% of the final grade Final exam: 50% of the final grade Midterm has 3 parts: 1. Applying discussed algorithms to problems 2. Solving problems similar to homework 3. Solving new problems October 8 review and discussion session Prepare a handwritten A5 ( 148 mm × 210 mm ) crib/cheat sheet
Algorithms and Data Structures Dr. Andreas Nüchter October 1, 2009 300 Announcements (2) Programming Assignment is out! Use C/C++ as programming language and make use of the code I am providing! Work in Pairs! You have to demonstrate the software to the TAs Make an appointment with one of the TAs! Write your and you partner’s name in the list @ my office door!

This preview has intentionally blurred sections. Sign up to view the full version.

View Full Document
Last Lecture Formal proof of the theorem: Theorem : The average number of comparisons for sorting keys is We need to minimize the path length of the corresponding decision tree An optimal decision tree has two child nodes for a comparison node Sorting in linear time with counting sort Introduction to Data Structures
Queues Dynamic set Delete operation is called de-queue Inset operation is called en-queue FIFO principle (First In First Out), i.e., the element that is removed from the queue is the oldest one in the queue. Queue can also be realized using an array Queue with 5 elements at the places

This preview has intentionally blurred sections. Sign up to view the full version.

View Full Document
Queues after the operations , and returns the value 15.
Queues

This preview has intentionally blurred sections. Sign up to view the full version.

View Full Document
Algorithms and Data Structures Dr. Andreas Nüchter October 1, 2009 305 Pointer in C/C++
Algorithms and Data Structures Dr. Andreas Nüchter October 1, 2009 306 Pointer in C/C++ Address A place in memory, where the data is stored The address of variable x is obtained by &x Pointer A variable that holds an address int i = 10; int * j = & i; /* j "points" to i */ 0x123aa8 10 0x123aa8 i name address contents 0x123aab j

This preview has intentionally blurred sections. Sign up to view the full version.

View Full Document
Algorithms and Data Structures Dr. Andreas Nüchter October 1, 2009 307 Pointer in C/C++ The data to which a pointer points is accessable with the * -operator &j is the address of i *j is the content of the memory at place j * -operator for dereferencing Meanings of * in C/C++ 1. Multiplication 2. Declaration of a pointer 3. Dereferencing int i = 10; int *j = &i; printf("i = %d\n", i); printf("j = %x\n", j); printf("j points to: %d\n", * j);
Algorithms and Data Structures Dr. Andreas Nüchter October 1, 2009 308 Pointer in C/C++ Let‘s use it int i = 10; int *j = &i; int ** k = &j; printf("%x\t%d\n", &i, i); printf("%x\t%x\t%d\n", &j, j, *j); printf("%x\t%x\t%x\t%d\n", &k, k, *k, ** k); 10 0x123aa8 i name address contents 0x123aa8 0x123aab j 0x123aab 0x123ab0 k

This preview has intentionally blurred sections. Sign up to view the full version.

View Full Document
Algorithms and Data Structures Dr. Andreas Nüchter October 1, 2009 309 Linked Lists Flexible representation of dynamic sets Linear ordering of objects, where the ordering is
This is the end of the preview. Sign up to access the rest of the document.

{[ snackBarMessage ]}