Lesson 10 Using and Sorting Lists

Size: px
Start display at page:

Download "Lesson 10 Using and Sorting Lists"

Transcription

1 Lesson What you will learn: how to create variables how to create lists how to add values to lists how to create ordered lists how to use IF ELSE how to create a list in a random order with no duplicates how to sort a random list back into order using a bubble sort Contents Exercise 1: Setting all the Variables and Lists to Zero... 3 Exercise 2: Creating a Random List... 4 Exercise 3: Bubble Sort... 5 Exercise 4: Using the List to Set Coordinates... 6 Introduction to Scratch Programming (2 nd Edition) Page 1 of 9 ZigZag Education, 2013

2 Sorting data into lists is a very useful process in computing. For example, in this exercise we will use a list of numbers to set the position of sprites on a screen using coordinates. We will create an ordered list, then reorder the values in the list into a random order and then use a technique called bubble sort to reorder the list. 1. Start by creating the variables as shown: End will be the highest value in the sorted list. Length will be the total number of values used in the list. Position will be the position of a value in the list. Start will be the lowest value in the sorted list. Temp will be used to store a temporary value in the bubble sort process. Value will hold the range of numbers in between the start and end values. Randomlist will hold the random values without repeats. Sortedlist will be used to create the sorted values in a given range between start and end. - Introduction to Scratch Programming (2 nd Edition) Page 2 of 9 ZigZag Education, 2013

3 Exercise 1: Setting all the Variables and Lists to Zero 2. Working on the stage, create a script as shown. 3. Create a script that will create the ordered list (push the first script out of the way). -3 has been used here because it will determine a coordinate on the screen later in another example any number would work. 3 has been used here because it will determine a coordinate on the screen later in another example any number would work. This section sets value to start then adds it to the list. Then value goes up by one and that is added to the list, and so on. Introduction to Scratch Programming (2 nd Edition) Page 3 of 9 ZigZag Education, 2013

4 Exercise 2: Creating a Random List It is easy to create random numbers the trick here is to produce random numbers that never repeat. We can achieve this by pulling the numbers from the sorted list in random order then deleting that number so that it cannot be used again. 4. Still working on the stage, create the script as shown: The purpose of the r is so that each section of the exercise can be run separately. The purpose of the wait is so that you can see each stage happening. The purpose of the broadcast command at the end of this script is to move some sprites around the screen using coordinates. We will set this up later in the exercise. Just select new from the drop-down list and then type randomise. Test the scripts that you have created so far you should see the ordered list populate then the numbers move across to the random list. Introduction to Scratch Programming (2 nd Edition) Page 4 of 9 ZigZag Education, 2013

5 Exercise 3: Bubble Sort Now we will create the script that sorts the numbers back into the correct order. This is done by a process known as bubble sort. In a bubble sort, the first two numbers are compared; if the second is smaller, then they are swapped over. Then the next two numbers are compared and so on. Eventually all the numbers are in order. It is an effective method for short lists and is one of many methods for sorting lists of numbers. 5. Still working on the stage, create the script as shown: At the beginning, length has to be reset because the last process reset it to 1. The If Else section compares the first two values if the first value is LARGER, it is copied into temp and the second value is used to replace it. The value in temp is then copied into the second value place. Then the position is changed by one. If the first value ISN T LARGER, the position value just moves to the next position. The wait is just so that you can see what is going on and the broadcast reorder is to trigger another process that we will come to next. Introduction to Scratch Programming (2 nd Edition) Page 5 of 9 ZigZag Education, 2013

6 Exercise 4: Using the List to Set Coordinates 6. Introduce some new sprites onto the screen which are the numbers Set the stage out as shown. We have left the cat to give instructions to the end user. Introduction to Scratch Programming (2 nd Edition) Page 6 of 9 ZigZag Education, 2013

7 8. For the cat sprite, create the script as shown: 9. For the number 1 sprite, create the script as shown: Introduction to Scratch Programming (2 nd Edition) Page 7 of 9 ZigZag Education, 2013

8 Each number sprite has a different starting position shown in the first script. The item number corresponds to the actual number of the sprite. Sprite number Start position (x) Start position (y) When you run the script, the numbers should go into the correct order, change order randomly when you type r and then go back into order again when you type s. Introduction to Scratch Programming (2 nd Edition) Page 8 of 9 ZigZag Education, 2013

9 In this example, the number sprites have been replaced by playing cards. The effect is that the cards shuffle, then automatically rearrange back into order again. Introduction to Scratch Programming (2 nd Edition) Page 9 of 9 ZigZag Education, 2013

Introduction to Scratch Programming v1.4 (Second Ed) Lesson 6 Calculator

Introduction to Scratch Programming v1.4 (Second Ed) Lesson 6 Calculator Lesson What you will learn: how to perform simple calculations using Scratch how to use variables how to develop a design how to use the else if function how to create animated buttons Contents Exercise

More information

Lesson 3 Creating and Using Graphics

Lesson 3 Creating and Using Graphics Lesson What you will learn: how to delete a sprite and import a new sprite how to draw using the pen feature of Scratch how to use the pen up and pen down feature how to change the colour of the pen how

More information

Teaching Kids to Program. Lesson Plan: Catch the Ball

Teaching Kids to Program. Lesson Plan: Catch the Ball Teaching Kids to Program Lesson Plan: Catch the Ball Step 1: 1. Open your web browser and go to SCRATCH (http://scratch.mit.edu/ ) 2. Sign in to your Scratch account by clicking on the button on the top

More information

Definition: A data structure is a way of organizing data in a computer so that it can be used efficiently.

Definition: A data structure is a way of organizing data in a computer so that it can be used efficiently. The Science of Computing I Lesson 4: Introduction to Data Structures Living with Cyber Pillar: Data Structures The need for data structures The algorithms we design to solve problems rarely do so without

More information

Add in a new balloon sprite, and a suitable stage backdrop.

Add in a new balloon sprite, and a suitable stage backdrop. Balloons Introduction You are going to make a balloon-popping game! Step 1: Animating a balloon Activity Checklist Start a new Scratch project, and delete the cat sprite so that your project is empty.

More information

Sorting Algorithms. + Analysis of the Sorting Algorithms

Sorting Algorithms. + Analysis of the Sorting Algorithms Sorting Algorithms + Analysis of the Sorting Algorithms Insertion Sort What if first k elements of array are already sorted? 4, 7, 12, 5, 19, 16 We can shift the tail of the sorted elements list down and

More information

Data Structures and Algorithms for Engineers

Data Structures and Algorithms for Engineers 0-630 Data Structures and Algorithms for Engineers David Vernon Carnegie Mellon University Africa vernon@cmu.edu www.vernon.eu Data Structures and Algorithms for Engineers 1 Carnegie Mellon University

More information

LINEAR INSERTION SORT

LINEAR INSERTION SORT LINEAR INSERTION SORT Textbook (pages 95 03) The term insertion sort refers to an entire category of sorting algorithms which work by successively taking each item in the array and finding its proper position.

More information

Introduction to Scratch

Introduction to Scratch Introduction to Scratch Familiarising yourself with Scratch The Stage Sprites Scripts Area Sequence of Instructions Instructions and Controls If a computer is a box think of a program as a man inside the

More information

Programming Scratch to Control a K NEX Fairground Ride

Programming Scratch to Control a K NEX Fairground Ride Programming Scratch to Control a K NEX Fairground Ride Raspberry Pi and K NEX System K NEX Model PiFace Motor Raspberry Pi Speaker LED Lights Switch Computer Control Parts Scratch Raspberry Pi PiFace How

More information

ICS 61 Game Systems and Design Introduction to Scratch

ICS 61 Game Systems and Design Introduction to Scratch ICS 61, Winter, 2015 Introduction to Scratch p. 1 ICS 61 Game Systems and Design Introduction to Scratch 1. Make sure your computer has a browser open at the address http://scratch.mit.edu/projects/editor/.

More information

AN INTRODUCTION TO SCRATCH (2) PROGRAMMING

AN INTRODUCTION TO SCRATCH (2) PROGRAMMING AN INTRODUCTION TO SCRATCH (2) PROGRAMMING Document Version 2 (04/10/2014) INTRODUCTION SCRATCH is a visual programming environment and language. It was launched by the MIT Media Lab in 2007 in an effort

More information

1 a = [ 5, 1, 6, 2, 4, 3 ] 4 f o r j i n r a n g e ( i + 1, l e n ( a ) 1) : 3 min = i

1 a = [ 5, 1, 6, 2, 4, 3 ] 4 f o r j i n r a n g e ( i + 1, l e n ( a ) 1) : 3 min = i Selection Sort Algorithm Principles of Computer Science II Sorting Algorithms This algorithm first finds the smallest element in the array and exchanges it with the element in the first position, then

More information

You may refer to the lesson on data structures (Introduction to Data Structures) as necessary.

You may refer to the lesson on data structures (Introduction to Data Structures) as necessary. The Science of Computing I Living with Cyber Raspberry Pi Activity 4: Arraynging Things In this activity, you will implement the insertion sort. You will need the following items: Raspberry Pi B v2 with

More information

# use temporary files to store partial results # remember to delete these temporary files when you do not need them anymore

# use temporary files to store partial results # remember to delete these temporary files when you do not need them anymore #!/bin/bash/ #Man entry # Script that reads a file and outputs a list of unique words # in the file, their frequency and total number # Usage: wsc.sh file finalres # This solution es not assume that we

More information

With the Photo-face project learners can incorporate digital media digital photos, and then transform these images in creative and surprising ways.

With the Photo-face project learners can incorporate digital media digital photos, and then transform these images in creative and surprising ways. Scratch Photo-face This project was designed to introduce Scratch in a way to bring the student/youth/adult into their work. One of the ideas that is integrated into the Scratch program is that is a tool

More information

EXERCISE ACROSS ABBOTT How to Create an Event

EXERCISE ACROSS ABBOTT How to Create an Event EXERCISE ACROSS ABBOTT How to Create an Event How to Create an Event with Exercise Across Abbott This step-by-step guide will show you how to create an Event on the Exercise Across Abbott website (www.exerciseacrossabbott.com).

More information

BEETLE GEOMETRY MODULE 2: INVESTIGATION 1. Exploring Pen

BEETLE GEOMETRY MODULE 2: INVESTIGATION 1. Exploring Pen BEETLE GEOMETRY Exploring Pen Ac@vity 2.1.1 Drawing Numerals ACTIVITY 2.1.1 Drawing Numerals Ac@vity 2.1.1 Drawing Numerals Open project 2-Drawing Numerals, save as a copy and rename. Read the setup script

More information

The Environment. Scratch Programming. The Environment. The Environment. The Environment. The Environment. Lesson 1: Introduction THE STAGE

The Environment. Scratch Programming. The Environment. The Environment. The Environment. The Environment. Lesson 1: Introduction THE STAGE Scratch Programming Lesson 1: Introduction Jt Scratch Lesson 1 Fall 2011 slide 2 THE STAGE Code Executes Here Default Sprite Jt Scratch Lesson 1 Fall 2011 slide 3 Jt Scratch Lesson 1 Fall 2011 slide 4

More information

You can delete the default blank background by clicking on its Delete button.

You can delete the default blank background by clicking on its Delete button. Quiz Project In this project, the application presents the user with an electronic quick made up of five questions. Before you start scripting, you need to have your questions ready. Create 5 trivia questions

More information

Mailman Max. The postcode is a great way to work out the next sorting office a letter should go to, so you ll use that.

Mailman Max. The postcode is a great way to work out the next sorting office a letter should go to, so you ll use that. Mailman Max In this project you will make a main postal sorting office. It will need to sort letters so that they can be put into vans going to the right local sorting offices. The postcode is a great

More information

Data Structures - Simple Sorting

Data Structures - Simple Sorting Data Structures - Simple Sorting Dr. TGI Fernando 1 2 December 21, 2011 1 Email: gishantha@dscs.sjp.ac.lk 2 URL: http://tgifernando.wordpress.com/ Dr. TGI Fernando () Data Structures - Simple Sorting December

More information

SCRATCH PROGRAMMING. Lesson 7: Create a Scratch Cartoon Animation

SCRATCH PROGRAMMING. Lesson 7: Create a Scratch Cartoon Animation SCRATCH PROGRAMMING Lesson 7: Create a Scratch Cartoon Animation In this lesson, we will create a Scratch Cartoon Animation. We will first create a story line. Based on the story line, we will create sprites

More information

In this lesson you will learn: How to capture the input from the user. How to write programs using variables and lists. Athletics Swimming Gymnastics

In this lesson you will learn: How to capture the input from the user. How to write programs using variables and lists. Athletics Swimming Gymnastics Lesson 4 A m In this lesson you will learn: How to capture the input from the user. How to write programs using variables and lists. Advanced Scratch Sports Day Jyoti and Tejas are planning to create a

More information

Lecture 6 Sorting and Searching

Lecture 6 Sorting and Searching Lecture 6 Sorting and Searching Sorting takes an unordered collection and makes it an ordered one. 1 2 3 4 5 6 77 42 35 12 101 5 1 2 3 4 5 6 5 12 35 42 77 101 There are many algorithms for sorting a list

More information

SCRATCH MODULE 3: NUMBER CONVERSIONS

SCRATCH MODULE 3: NUMBER CONVERSIONS SCRATCH MODULE 3: NUMBER CONVERSIONS INTRODUCTION The purpose of this module is to experiment with user interactions, error checking input, and number conversion algorithms in Scratch. We will be exploring

More information

More Counting Sort and Sorting-by-Key

More Counting Sort and Sorting-by-Key Tony Gong ITEE University of Queensland In the lectures last week we looked at the counting sort algorithm for sorting a set of integers that come from some specific domain, i.e. every integer is in some

More information

Triggering audio playback. Playback Modes. Trigger Modes

Triggering audio playback. Playback Modes. Trigger Modes Triggering audio playback Playback is triggered via the trigger inputs. All inputs are internally pulled up and, if left unconnected, have a voltage of 3.3V (logic 1 ). 5V signal is tolerated and also

More information

ONE HOUR ANIMATION. Will you be a Scratcher upon completion of this session? Definitely. Learn how to write a basic script to animate a sprite.

ONE HOUR ANIMATION. Will you be a Scratcher upon completion of this session? Definitely. Learn how to write a basic script to animate a sprite. ONE HOUR ANIMATION 45-60 minutes Will you be a Scratcher upon completion of this session? Definitely. Learn how to write a basic script to animate a sprite. 1. A computer or laptop A computer or 2. A mouse

More information

Assignment 2. CS 234 Fall 2018 Sandy Graham. Create()

Assignment 2. CS 234 Fall 2018 Sandy Graham. Create() Assignment 2 CS 234 Fall 2018 Sandy Graham Coverage: Modules 3 and 4. This assignment consists of a written component and a programming component. Please read the course website carefully to ensure that

More information

Scratch Lesson 2: Movies Made From Scratch Lesson Framework

Scratch Lesson 2: Movies Made From Scratch Lesson Framework Scratch Lesson 2: Movies Made From Scratch Lesson Framework Scratch makes it easy to program your own interactive stories, games, and animations and share your creations on the web. As you create and share

More information

SORTING. How? Binary Search gives log(n) performance.

SORTING. How? Binary Search gives log(n) performance. SORTING Chapter 8 Sorting 2 Why sort? To make searching faster! How? Binary Search gives log(n) performance. There are many algorithms for sorting: bubble sort, selection sort, insertion sort, quick sort,

More information

In this lesson you are going to create a drawing program similar to Windows Paint. 1. Start with a new project and remove the default cat sprite.

In this lesson you are going to create a drawing program similar to Windows Paint. 1. Start with a new project and remove the default cat sprite. Drawing Program In this lesson you are going to create a drawing program similar to Windows Paint. 1. Start with a new project and remove the default cat sprite. 2. Create a new sprite. 3. The new sprite

More information

VISUAL PROGRAMMING BY SCRATCH

VISUAL PROGRAMMING BY SCRATCH Faculty of Information Technology VISUAL PROGRAMMING BY SCRATCH Dr. Nguyen Chi Trung Faculty of Information Technology Hanoi National University of Education Chapter 1. Getting Started What is the Scratch?

More information

Searching for Information. A Simple Method for Searching. Simple Searching. Class #21: Searching/Sorting I

Searching for Information. A Simple Method for Searching. Simple Searching. Class #21: Searching/Sorting I Class #21: Searching/Sorting I Software Design II (CS 220): M. Allen, 26 Feb. 18 Searching for Information Many applications involve finding pieces of information Finding a book in a library or store catalogue

More information

Module 4: Creating Content Lesson 6: Creating Documents Learn

Module 4: Creating Content Lesson 6: Creating Documents Learn Module 4: Creating Content Lesson 6: Creating Documents Learn Welcome to Module 4, Lesson 6. In this lesson, you will learn how to create, edit, and save new documents based on your uploaded data using

More information

Sorting. Quicksort analysis Bubble sort. November 20, 2017 Hassan Khosravi / Geoffrey Tien 1

Sorting. Quicksort analysis Bubble sort. November 20, 2017 Hassan Khosravi / Geoffrey Tien 1 Sorting Quicksort analysis Bubble sort November 20, 2017 Hassan Khosravi / Geoffrey Tien 1 Quicksort analysis How long does Quicksort take to run? Let's consider the best and the worst case These differ

More information

CPS111 Victory Thru Scratch Lab

CPS111 Victory Thru Scratch Lab CPS111 Victory Thru Scratch Lab Introduction: Computer Science (or computational science) is all about algorithms those lists of steps that carry out some sort of task. Therefore to better understand computer

More information

SPRITES Making Things Move Around The Screen

SPRITES Making Things Move Around The Screen Unless you re playing something like Zork (GREATEST game in the world BTW!), you will likely need to move images around the screen. In this lesson we re going to work with simple 2D images, normally called

More information

Version History: 1.0: ab initio. Planning Notes:

Version History: 1.0: ab initio. Planning Notes: Title: Creative Writing with a Fork in the Road Author(s): Richard (Rick) G. Freedman Approximate Time: Varies by length of story and use of extra features Level: Grade 6-7 (if some code is already provided),

More information

SCJ2013 Data Structure & Algorithms. Bubble Sort. Nor Bahiah Hj Ahmad & Dayang Norhayati A. Jawawi

SCJ2013 Data Structure & Algorithms. Bubble Sort. Nor Bahiah Hj Ahmad & Dayang Norhayati A. Jawawi SCJ2013 Data Structure & Algorithms Bubble Sort Nor Bahiah Hj Ahmad & Dayang Norhayati A. Jawawi 1 Bubble Sort Sorting activities for Bubble: Go through multiple passes over the array. In every pass: Compare

More information

WASHINGTON STATE MIDDLE SCHOOL COMPUTER SCIENCE COMPETITION 2017

WASHINGTON STATE MIDDLE SCHOOL COMPUTER SCIENCE COMPETITION 2017 WASHINGTON STATE MIDDLE SCHOOL COMPUTER SCIENCE COMPETITION 2017 Individual Challenge Grades 5 6 30 minutes Please read these directions carefully before beginning. Breaking any of the rules is grounds

More information

CSE 373. Sorting 1: Bogo Sort, Stooge Sort, Bubble Sort reading: Weiss Ch. 7. slides created by Marty Stepp

CSE 373. Sorting 1: Bogo Sort, Stooge Sort, Bubble Sort reading: Weiss Ch. 7. slides created by Marty Stepp CSE 373 Sorting 1: Bogo Sort, Stooge Sort, Bubble Sort reading: Weiss Ch. 7 slides created by Marty Stepp http://www.cs.washington.edu/373/ University of Washington, all rights reserved. 1 Sorting sorting:

More information

Sorting. Popular algorithms: Many algorithms for sorting in parallel also exist.

Sorting. Popular algorithms: Many algorithms for sorting in parallel also exist. Sorting Popular algorithms: Selection sort* Insertion sort* Bubble sort* Quick sort* Comb-sort Shell-sort Heap sort* Merge sort* Counting-sort Radix-sort Bucket-sort Tim-sort Many algorithms for sorting

More information

Types of Interrupts:

Types of Interrupts: Interrupt structure Introduction Interrupt is signals send by an external device to the processor, to request the processor to perform a particular task or work. Mainly in the microprocessor based system

More information

Microsoft Microsoft CRM Installation and Configuration.

Microsoft Microsoft CRM Installation and Configuration. Microsoft 10-184 Microsoft CRM Installation and Configuration http://killexams.com/exam-detail/10-184 Answer: B, C QUESTION: 105 If you to attach a note to a case, which security privileges control whether

More information

ECE 2574: Data Structures and Algorithms - Basic Sorting Algorithms. C. L. Wyatt

ECE 2574: Data Structures and Algorithms - Basic Sorting Algorithms. C. L. Wyatt ECE 2574: Data Structures and Algorithms - Basic Sorting Algorithms C. L. Wyatt Today we will continue looking at sorting algorithms Bubble sort Insertion sort Merge sort Quick sort Common Sorting Algorithms

More information

WASHINGTON STATE MIDDLE SCHOOL COMPUTER SCIENCE COMPETITION 2017

WASHINGTON STATE MIDDLE SCHOOL COMPUTER SCIENCE COMPETITION 2017 WASHINGTON STATE MIDDLE SCHOOL COMPUTER SCIENCE COMPETITION 2017 Individual Challenge Grades 7 8 30 minutes Please read these directions carefully before beginning. Breaking any of the rules is grounds

More information

Homework Assignment #3. 1 (5 pts) Demonstrate how mergesort works when sorting the following list of numbers:

Homework Assignment #3. 1 (5 pts) Demonstrate how mergesort works when sorting the following list of numbers: CISC 4080 Computer Algorithms Spring, 2019 Homework Assignment #3 1 (5 pts) Demonstrate how mergesort works when sorting the following list of numbers: 6 1 4 2 3 8 7 5 2 Given the following array (list),

More information

IUSE Knowledge Test. 1. Demographic Questions. IUSE Knowledge Test. 2. Computational Thinking Knowledge Test

IUSE Knowledge Test. 1. Demographic Questions. IUSE Knowledge Test. 2. Computational Thinking Knowledge Test IUSE Knowledge Test 1. Demographic Questions Your student ID number will be erased from the data file after this survey is linked to the other surveys you have taken or will be taking. * 1. Please enter

More information

Very simple programming, limited exposure to assignment and variables minutes, or a full lesson with extension exercises

Very simple programming, limited exposure to assignment and variables minutes, or a full lesson with extension exercises Box Variables Age group: Abilities assumed: Time: Size of group: Focus Variables Assignment Sequencing Programming 10 adult Very simple programming, limited exposure to assignment and variables 15-20 minutes,

More information

Searching in General

Searching in General Searching in General Searching 1. using linear search on arrays, lists or files 2. using binary search trees 3. using a hash table 4. using binary search in sorted arrays (interval halving method). Data

More information

MODULE 4 INSTRUCTIONS: LANGUAGE OF THE MACHINE

MODULE 4 INSTRUCTIONS: LANGUAGE OF THE MACHINE MODULE 4 INSTRUCTIONS: LANGUAGE OF THE MACHINE 1 ARCHITECTURE MODEL The basic instruction set of a computer is comprised of sequences of REGISTER TRANSFERS. Example: Add A, B, C Register B # A

More information

S3 Scratch Programming

S3 Scratch Programming LOREM ST LOUIS IPSUM DOLOR ST LOUIS SCHOOL S3 Computer Literacy S3 Scratch Programming Dominic Kwok CHAPTER 1 Scratch After studying this chapter, you will be able to create a simple Scratch program upload

More information

Make a game in which you play the notes of a song as they scroll down the stage.

Make a game in which you play the notes of a song as they scroll down the stage. Raspberry Pi Projects Binary Hero Introduction Make a game in which you play the notes of a song as they scroll down the stage. What you will make Click the green ag to play. Use z, x, c and v to play

More information

STUDENT LESSON A17 Quadratic Sorting Algorithms

STUDENT LESSON A17 Quadratic Sorting Algorithms STUDENT LESSON A17 Quadratic Sorting Algorithms Java Curriculum for AP Computer Science, Student Lesson A17 1 STUDENT LESSON A17 Quadratic Sorting Algorithms INTRODUCTION: In this lesson, you will learn

More information

Meet the Cast. The Cosmic Defenders: Gobo, Fabu, and Pele The Cosmic Defenders are transdimensional

Meet the Cast. The Cosmic Defenders: Gobo, Fabu, and Pele The Cosmic Defenders are transdimensional Meet the Cast Mitch A computer science student who loves to make cool programs, he s passionate about movies and art, too! Mitch is an all-around good guy. The Cosmic Defenders: Gobo, Fabu, and Pele The

More information

Business Rules Engine: Collections & Service Orders. Jessie Abel Kelly McLendon

Business Rules Engine: Collections & Service Orders. Jessie Abel Kelly McLendon Business Rules Engine: Collections & Service Orders Jessie Abel Kelly McLendon Rules Engine Modules Arrangements: Used to define rules that govern creation of arrangements on all platforms. Collections:

More information

Problem:Given a list of n orderable items (e.g., numbers, characters from some alphabet, character strings), rearrange them in nondecreasing order.

Problem:Given a list of n orderable items (e.g., numbers, characters from some alphabet, character strings), rearrange them in nondecreasing order. BRUTE FORCE 3.1Introduction Brute force is a straightforward approach to problem solving, usually directly based on the problem s statement and definitions of the concepts involved.though rarely a source

More information

8/2/10. Looking for something COMP 10 EXPLORING COMPUTER SCIENCE. Where is the book Modern Interiors? Lecture 7 Searching and Sorting TODAY'S OUTLINE

8/2/10. Looking for something COMP 10 EXPLORING COMPUTER SCIENCE. Where is the book Modern Interiors? Lecture 7 Searching and Sorting TODAY'S OUTLINE Looking for something COMP 10 EXPLORING COMPUTER SCIENCE Where is the book Modern Interiors? Lecture 7 Searching and Sorting TODAY'S OUTLINE Searching algorithms Linear search Complexity Sorting algorithms

More information

To access Vendor Data Mining, navigate to Financial Management > Vendors > Data Mining.

To access Vendor Data Mining, navigate to Financial Management > Vendors > Data Mining. Vendor Data Mining Data Mining is a flexible reporting tool that can be used to create user defined reports on vendor information not otherwise collected by the software in a standard report. To access

More information

Customizing FlipCharts Promethean Module 2 (ActivInspire)

Customizing FlipCharts Promethean Module 2 (ActivInspire) Customizing FlipCharts Promethean Module 2 (ActivInspire) Section 1: Browsers The browsers (located on the left side of the flipchart) are menus for various functions. To view the browsers, click Main

More information

REDCap Randomization Module

REDCap Randomization Module REDCap Randomization Module The Randomization Module within REDCap allows researchers to randomly assign participants to specific groups. Table of Contents 1 Table of Contents 2 Enabling the Randomization

More information

O(n): printing a list of n items to the screen, looking at each item once.

O(n): printing a list of n items to the screen, looking at each item once. UNIT IV Sorting: O notation efficiency of sorting bubble sort quick sort selection sort heap sort insertion sort shell sort merge sort radix sort. O NOTATION BIG OH (O) NOTATION Big oh : the function f(n)=o(g(n))

More information

Sorting Algorithms. - rearranging a list of numbers into increasing (or decreasing) order. Potential Speedup

Sorting Algorithms. - rearranging a list of numbers into increasing (or decreasing) order. Potential Speedup Sorting Algorithms - rearranging a list of numbers into increasing (or decreasing) order. Potential Speedup The worst-case time complexity of mergesort and the average time complexity of quicksort are

More information

Copyright 2012 Pulse Systems, Inc. Page 1 of 39

Copyright 2012 Pulse Systems, Inc. Page 1 of 39 The PulsePro Transcription module provides a method of creating and storing patient transcription documents within the PulsePro database. The Transcription Filter screen allows the user to display a list

More information

S O R T I N G Sorting a list of elements implemented as an array. In all algorithms of this handout the sorting of elements is in ascending order

S O R T I N G Sorting a list of elements implemented as an array. In all algorithms of this handout the sorting of elements is in ascending order S O R T I N G Sorting is interpreted as arranging data in some particular order. In this handout we discuss different sorting techniques for a list of elements implemented as an array. In all algorithms

More information

UNIT 2 LINEAR AND EXPONENTIAL RELATIONSHIPS Lesson 1: Graphs As Solution Sets and Function Notation

UNIT 2 LINEAR AND EXPONENTIAL RELATIONSHIPS Lesson 1: Graphs As Solution Sets and Function Notation Lesson : Graphs As Solution Sets and Function Notation Guided Practice.. Example Is the relation below a function? Use a mapping diagram to determine your answer. {(, ), (, ), (, ), (, ), (, ), (, )}.

More information

IT82: Multimedia Macromedia Director Practical 1

IT82: Multimedia Macromedia Director Practical 1 IT82: Multimedia Macromedia Director Practical 1 Over the course of these labs, you will be introduced Macromedia s Director multimedia authoring tool. This is the de facto standard for time-based multimedia

More information

Array Packing Implementation A Parallel approach. By, Abhishek Cumbakonam Desikan Rajesh Balasubramanian Ramalingam Sankaran Aswin Gokulachandran

Array Packing Implementation A Parallel approach. By, Abhishek Cumbakonam Desikan Rajesh Balasubramanian Ramalingam Sankaran Aswin Gokulachandran Array Packing Implementation A Parallel approach By, Abhishek Cumbakonam Desikan Rajesh Balasubramanian Ramalingam Sankaran Aswin Gokulachandran The Problem Given an array X, having some labelled items.

More information

(Subroutines in Visual Basic)

(Subroutines in Visual Basic) Ch 7 Procedures (Subroutines in Visual Basic) Visual Basic Procedures Structured Programs To simplify writing complex programs, most Programmers (Designers/Developers) choose to split the problem into

More information

Using Tables, Sparklines and Conditional Formatting. Module 5. Adobe Captivate Wednesday, May 11, 2016

Using Tables, Sparklines and Conditional Formatting. Module 5. Adobe Captivate Wednesday, May 11, 2016 Slide 1 - Using Tables, Sparklines and Conditional Formatting Using Tables, Sparklines and Conditional Formatting Module 5 Page 1 of 27 Slide 2 - Lesson Objectives Lesson Objectives Explore the find and

More information

CS 106 Introduction to Computer Science I

CS 106 Introduction to Computer Science I CS 106 Introduction to Computer Science I 06 / 11 / 2015 Instructor: Michael Eckmann Today s Topics Comments and/or Questions? Sorting Searching Michael Eckmann - Skidmore College - CS 106 - Summer 2015

More information

Lecture 5 - Control Structure Applications

Lecture 5 - Control Structure Applications Lecture 5 - Control Structure Applications Variable indexing and examples of program writing Variable Indexing & built in functions indexing positions in an array array Grade contains 6 locations to store

More information

Data Analysis & Probability

Data Analysis & Probability Unit 5 Probability Distributions Name: Date: Hour: Section 7.2: The Standard Normal Distribution (Area under the curve) Notes By the end of this lesson, you will be able to Find the area under the standard

More information

4.1 COMPUTATIONAL THINKING AND PROBLEM-SOLVING

4.1 COMPUTATIONAL THINKING AND PROBLEM-SOLVING 4.1 COMPUTATIONAL THINKING AND PROBLEM-SOLVING 4.1.2 ALGORITHMS ALGORITHM An Algorithm is a procedure or formula for solving a problem. It is a step-by-step set of operations to be performed. It is almost

More information

C++ PROGRAMMING SKILLS Part 4: Arrays

C++ PROGRAMMING SKILLS Part 4: Arrays C++ PROGRAMMING SKILLS Part 4: Arrays Outline Introduction to Arrays Declaring and Initializing Arrays Examples Using Arrays Sorting Arrays: Bubble Sort Passing Arrays to Functions Computing Mean, Median

More information

1/ COP 3503 FALL 2012 SHAYAN JAVED LECTURE 16. Programming Fundamentals using Java

1/ COP 3503 FALL 2012 SHAYAN JAVED LECTURE 16. Programming Fundamentals using Java 1/ 137 1 COP 3503 FALL 2012 SHAYAN JAVED LECTURE 16 Programming Fundamentals using Java 2/ 137 Sorting Another crucial problem. Used everywhere: Sorting numbers (prices/grades/ratings/etc..) Names Dates

More information

CSc 110, Spring 2017 Lecture 39: searching

CSc 110, Spring 2017 Lecture 39: searching CSc 110, Spring 2017 Lecture 39: searching 1 Sequential search sequential search: Locates a target value in a list (may not be sorted) by examining each element from start to finish. Also known as linear

More information

Lineup. Introduction. What you will need. Import your costumes. What you will make. What you will learn. Hardware. Software

Lineup. Introduction. What you will need. Import your costumes. What you will make. What you will learn. Hardware. Software Raspberry Pi Projects Lineup Introduction In this project you will be making a game using Scratch 2.0. The game will involve nding a stamped sprite on the stage, hidden amongst a huge group of other stamps.

More information

CS107, Lecture 9 C Generics Function Pointers

CS107, Lecture 9 C Generics Function Pointers CS107, Lecture 9 C Generics Function Pointers Reading: K&R 5.11 This document is copyright (C) Stanford Computer Science and Nick Troccoli, licensed under Creative Commons Attribution 2.5 License. All

More information

The Collections Workbench can be used to view and manage accounts. Click anywhere to continue. Copyright 2012 Pulse Systems, Inc.

The Collections Workbench can be used to view and manage accounts. Click anywhere to continue. Copyright 2012 Pulse Systems, Inc. The Collections Workbench can be used to view and manage accounts. Click anywhere to continue Copyright 2012 Pulse Systems, Inc. Page 1 of 28 To begin, it is assumed that you are logged in the PulsePro

More information

Operations. Priority Queues & Heaps. Prio-Q as Array. Niave Solution: Prio-Q As Array. Prio-Q as Sorted Array. Prio-Q as Sorted Array

Operations. Priority Queues & Heaps. Prio-Q as Array. Niave Solution: Prio-Q As Array. Prio-Q as Sorted Array. Prio-Q as Sorted Array Operations Priority Queues & Heaps : insert item with a priority : remove the item with highest priority, and break ties with FIFO ordering For simplicity: we use an int as the object and the priority

More information

CS 61B Midterm 1 Guerrilla Section Spring 2018 February 10, 2018

CS 61B Midterm 1 Guerrilla Section Spring 2018 February 10, 2018 CS 61B Midterm 1 Guerrilla Section Spring 2018 February 10, 2018 Instructions Form a small group. Start on the first problem. Check off with a helper or discuss your solution process with another group

More information

CISC

CISC CISC-235 20180115+17+19 Much of the material we covered this week was already posted in the notes for last week. These notes take up where those left off, and fill in some gaps. We have discussed the notation

More information

CSE Lecture In Class Example Handout

CSE Lecture In Class Example Handout CSE 30321 Lecture 07-09 In Class Example Handout Part A: A Simple, MIPS-based Procedure: Swap Procedure Example: Let s write the MIPS code for the following statement (and function call): if (A[i] > A

More information

The University Of Michigan. EECS402 Lecture 07. Andrew M. Morgan. Sorting Arrays. Element Order Of Arrays

The University Of Michigan. EECS402 Lecture 07. Andrew M. Morgan. Sorting Arrays. Element Order Of Arrays The University Of Michigan Lecture 07 Andrew M. Morgan Sorting Arrays Element Order Of Arrays Arrays are called "random-access" data structures This is because any element can be accessed at any time Other

More information

A linked list grows as data is added to it. In a linked list each item is packaged into a node.

A linked list grows as data is added to it. In a linked list each item is packaged into a node. Lesson 4 Data Structures What is a data structure? A data structure is a particular way of organizing data in a computer. A data structure that we have already encountered is the array. An array stores

More information

CS125 : Introduction to Computer Science. Lecture Notes #38 and #39 Quicksort. c 2005, 2003, 2002, 2000 Jason Zych

CS125 : Introduction to Computer Science. Lecture Notes #38 and #39 Quicksort. c 2005, 2003, 2002, 2000 Jason Zych CS125 : Introduction to Computer Science Lecture Notes #38 and #39 Quicksort c 2005, 2003, 2002, 2000 Jason Zych 1 Lectures 38 and 39 : Quicksort Quicksort is the best sorting algorithm known which is

More information

Reporting for Fundraising

Reporting for Fundraising Strategies for Supporting Fundraising Reporting for Fundraising Functions The Value of User Defined Functions in Your Data Warehouse. SupportingAdvancement.Com SupportingAdvancement.Com. All rights reserved.

More information

Lecture Notes CPSC 122 (Fall 2014) Today Quiz 7 Doubly Linked Lists (Unsorted) List ADT Assignments Program 8 and Reading 6 out S.

Lecture Notes CPSC 122 (Fall 2014) Today Quiz 7 Doubly Linked Lists (Unsorted) List ADT Assignments Program 8 and Reading 6 out S. Today Quiz 7 Doubly Linked Lists (Unsorted) List ADT Assignments Program 8 and Reading 6 out S. Bowers 1 of 11 Doubly Linked Lists Each node has both a next and a prev pointer head \ v1 v2 v3 \ tail struct

More information

Errata for C++ and Algorithmic Thinking for the Complete Beginner

Errata for C++ and Algorithmic Thinking for the Complete Beginner Errata for C++ and Algorithmic Thinking for the Complete Beginner 12 What it Hardware? The Central Processing Unit (CPU) This is the part of a computer that actually performs all the tasks defined in a

More information

Insight Annotated Wireframes

Insight Annotated Wireframes Insight 3.. Annotated Wireframes About this document Annotated Wireframes documents the interaction design that is specific to a page, section, or page element. For global design, refer to Interaction

More information

COMP1511 focuses on writing programs. Effciency is also important. Often need to consider:

COMP1511 focuses on writing programs. Effciency is also important. Often need to consider: Efficiency COMP1511 focuses on writing programs. Effciency is also important. Often need to consider: execution time memory use. A correct but slow program can be useless. Efficiency often depends on the

More information

Outline. Parts 1 to 3 introduce and sketch out the ideas of OOP. Part 5 deals with these ideas in closer detail.

Outline. Parts 1 to 3 introduce and sketch out the ideas of OOP. Part 5 deals with these ideas in closer detail. OOP in Java 1 Outline 1. Getting started, primitive data types and control structures 2. Classes and objects 3. Extending classes 4. Using some standard packages 5. OOP revisited Parts 1 to 3 introduce

More information

Sorting and Searching Algorithms

Sorting and Searching Algorithms Sorting and Searching Algorithms Tessema M. Mengistu Department of Computer Science Southern Illinois University Carbondale tessema.mengistu@siu.edu Room - Faner 3131 1 Outline Introduction to Sorting

More information

FORTH SEMESTER DIPLOMA EXAMINATION IN ENGINEERING/ TECHNOLIGY- MARCH, 2012 DATA STRUCTURE (Common to CT and IF) [Time: 3 hours

FORTH SEMESTER DIPLOMA EXAMINATION IN ENGINEERING/ TECHNOLIGY- MARCH, 2012 DATA STRUCTURE (Common to CT and IF) [Time: 3 hours TED (10)-3071 Reg. No.. (REVISION-2010) (Maximum marks: 100) Signature. FORTH SEMESTER DIPLOMA EXAMINATION IN ENGINEERING/ TECHNOLIGY- MARCH, 2012 DATA STRUCTURE (Common to CT and IF) [Time: 3 hours PART

More information

Objectivities. Experiment 1. Lab6 Array I. Description of the Problem. Problem-Solving Tips

Objectivities. Experiment 1. Lab6 Array I. Description of the Problem. Problem-Solving Tips Lab6 Array I Objectivities 1. Using rand to generate random numbers and using srand to seed the random-number generator. 2. Declaring, initializing and referencing arrays. 3. The follow-up questions and

More information

CSE 143 Lecture 22. Sorting. reading: 13.1, slides adapted from Marty Stepp and Hélène Martin

CSE 143 Lecture 22. Sorting. reading: 13.1, slides adapted from Marty Stepp and Hélène Martin CSE 143 Lecture 22 Sorting reading: 13.1, 13.3-13.4 slides adapted from Marty Stepp and Hélène Martin http://www.cs.washington.edu/143/ Sorting sorting: Rearranging the values in an array or collection

More information