CSE 12 Week Two 2

CSE 12 Week Two 2 - CSE 12, Week Two, Lecture Two Stack:...

Info iconThis preview shows pages 1–2. Sign up to view the full content.

View Full Document Right Arrow Icon
Stack: The first data structure to study in CSE 12 What: - A container object that is defined by behavior: o The first item in the last item out-FILO o The last item in is the first item out-LIFO o Array based stack-hw2 o Linked-list based stack-hw3 Basic operations: - Push: insert into the stack - Pop: remove from the stack - Top: viewing of the top stack item (in class demo) Stacks in the real world: Dishes,cards,papers Computer related that everyone used today: - Email-if read last message in - Web-browser-checked link: push ; back: pop Run-Time Stack: - function/method call: push - function/method return: pop - current function executing: top Dynamic Memory Allocation: What: - allocating memory from the heap at runtime How: - C: mullac (size_in_bytes) - Java/C++: new array/object (java) new array/object/type (c++) How to give back memory: - C: free (a pointer to the memory allocated) - Java: garbage collector - C++: delete pointer_from_new When: - Java: o want an object o want an array - C/C++ o Objects, arrays can exist: RTS, data, heap o don’t know how much we need at compile time
Background image of page 1

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

View Full DocumentRight Arrow Icon
Image of page 2
This is the end of the preview. Sign up to access the rest of the document.

This note was uploaded on 04/13/2008 for the course CSE 12 taught by Professor Gary during the Spring '08 term at UCSD.

Page1 / 6

CSE 12 Week Two 2 - CSE 12, Week Two, Lecture Two Stack:...

This preview shows document pages 1 - 2. Sign up to view the full document.

View Full Document Right Arrow Icon
Ask a homework question - tutors are online