-
Notifications
You must be signed in to change notification settings - Fork 75
05. Searching
Lakivisi edited this page Jun 18, 2021
·
11 revisions
Linear and Binary Search
- Send out pre-session reading materials by 8th June
June 15 2021, 7:30- 9 am EAT
ℹ Have a time keeper
- Language to use (Python)
- Replit Link
- Join Link for students
-
5 min: ice-break : Search
- All of us have misplaced something and spent considerable amount of time finding it. Give examples of something that you misplaced, how long it took you to find it, if at all you did, and any strategy/plan that you came up for searching for it. e.g - Forgetting where you packed your car, spending 10 minutes finding it, going floor by floor to find it
-
Notion of equality:
- Primitive types
- Reference types
-
Search concept/ What's search is all about
-
Types of collections/bags that contains primitive and reference types and have students search (Student driven) i.e:
- Array of integers
- Array of students objects
-
Linear search - Introduce the label towards the last and explain why it's called Linear
- Added here
- One
- Two
June 18 2021, 7:30 - 9 am EAT
ℹ Have a time keeper
- Language to use: Python
- Replt
- 5 min: ice-break - Informally introduce the concept using an address book analogy with names ordered alphabetically
- Total order ( 1 <= 3 <= 3)
- Find the middle: Given a collection X of N items, find the index of an element at the center
- Slicing on index range: Given a collection X of N items, return elements that start from index i to index i + N
- Slicing on a match
- A student try to find
- Label it towards the last and explain why its called Binary
- As an exercise : Provide a case for what they think which is efficient between Binary and Linear (Listen in during the recap session)
- Calculate run time difference between Linear and Binary(towards the first)
- "Break down a huge task into smaller pieces and solving them"
- Recursive approach (Assignment) / iterative approach - Iterative approach
- By copy the collections -
- Doing in place (index - pointer) - Assignment (Best approach)
June 22 2021, 8:00 - 9 am EAT
- Review tasks/assignments
- Answer questions
- Open discussions
- Applications of Search (Why do we need it)
- Why search is a hard problem