You assign each int with a particular id

Assignment Help Data Structure & Algorithms
Reference no: EM13165817

Write a program that checks if a sort being used is stable (Use function pointer to pass the function of the sort routine).

For example,


1. I have an array of ints (4, 5, 6, 5, 4, 6)

2. You assign each int with a particular ID.
Array (4, 5, 6, 5, 4, 6)
ID (1, 2, 3, 4, 5, 6)

The first element, which is four, is assigned with ID 1.
The second element, which is five, is assigned with ID 2.
and so on.......

3. Sort the array.
Array (4, 4, 5, 5, 6, 6)
ID (1, 5, 2, 4, 3, 6)

This sort is stable because

First int 4's ID (1) < second int 4's ID (5)
First int 5,s ID (2) < second int 5's ID (4)

Reference no: EM13165817

Questions Cloud

Explores the performance consequences : This problem explores the performance consequences of having only a single level of cache in a modern processor with 40 ns DRAM column access time and a clock period of 400 ps (clock frequency 2.5 GHz). You are given the following data: A particul..
A file system stores every file under a i-node : suppose a file system stores every file under a i-node similar to (but may not be the same as) the Unix V7 File System. The i-node contains 15 addresses, each address has 32 bits (4 bytes).
Value referenced by the pointer. : Add 10 to the value referenced by pointer switch.Add 4 to the address stored in pointer switch.Subtract 5 from the value referenced by the pointer.
Create an application for disney''s cottages : Create an application for Disney's Cottages, a weekend getaway resort that rents cottages and boats to use on the local lake
You assign each int with a particular id : You assign each int with a particular ID.Array (4, 5, 6, 5, 4, 6) ID (1, 2, 3, 4, 5, 6)
A machine has a 32-bit address space and an 4-kb page : A machine has a 32-bit address space and an 4-KB page. Suppose a simple OS just boot up on the machine, running a single process. The process uses 2 memory pages for the text and data memory (combined) near the lowest virtual address, and 1 memory pa..
If ptr is a pointer to a character : If ptr is a pointer to a character and has been initialized to point to the first element of arr, write a statement using ptr that is equivalent to the statement array[4] = 12.
Various search trees and numerous sorting techniques : This week we were introduced to various search trees and numerous sorting techniques. Taking into consideration what you have learned this week, discuss how you can help Bob with his problem.
Test a program that prompts for the user : Write and test a program that prompts for the user to input a file name and uses two functions head() and tail() - head() displays the first 10 lines of a file

Reviews

Write a Review

Data Structure & Algorithms Questions & Answers

  Find the checksum field in a single parity bit scheme

Assume that the information content of a packet is the bit pattern 1111000010100101 and an even parity is being used

  Describe sorting algorithms and how they work

Describe sorting algorithms and how they work

  Modify bellman ford algorithm to find negative weight cycle

Demonstrate how to modify the Bellman Ford algorithm to find and print a negative weight cycle in a weighted directed graph G if one exists.

  Create greedy algorithm to find market to buy apples

Assume we drive pickup truck from city A to city B. Along high way, we will go through n apple markets, labeled with 1, 2, ..., n, where you can buy or sell apples. which means you buy and sell apples at the same market i.

  Running time analyses of all the methods

You need to give the running time analyses of all the methods in terms of the Big O notation. Include your running time analyses in the source file of the CompressedSuffixTrie class and comment out them.

  Design randomized algorithm for solving decoding problem

The Viterbi algorithm is a deterministic algorithm for solving the Decoding problem. Design a randomized algorithm for solving the Decoding problem.

  Question about multi dimensional arrays

Multi-dimensional arrays could cost a lot of memory. Determine how much memory does it take to create an integer array of 3 dimensions,

  Implementation of graph

Give the two input nodes after the graph has been built from the command prompt.

  Users and it organizations arm against phishing attacks

How users and IT organizations must arm themselves against these attacks?

  Hardware platform of the target embedded systems

An embedded system is a computer system performing dedicated functions within a larger mechanical or electrical system. Embedded systems range from portable devices such as Google Glasses, to large stationary installations like traffic lights, fa..

  Question about shortest prefixes

A prefix of a string is a substring string at the beginning of the given string. The prefixes of "carbon" are: c, ca, car, carb, carbo and carbon.

  Consider a queue data structure

Consider a queue data structure, where the two operations of interest are enqueue (at the back of the queue) and dequeue (from the front of the queue). A queue is thus a FIFO (first in-first out) structure. Suppose we implement a queue by using tw..

Free Assignment Quote

Assured A++ Grade

Get guaranteed satisfaction & time on delivery in every assignment order you paid with us! We ensure premium quality solution document along with free turntin report!

All rights reserved! Copyrights ©2019-2020 ExpertsMind IT Educational Pvt Ltd