- write program that can process sequence of stock buy and sell orders as described in exercise - - let be set of points in the plane with distinct integer xand ycoordinates let be complete binary tree storing the points from at its external nodessuch that the points are ordered left to right by increasing -coordinates for each node in let (vdenote the subset of consisting of points stored in the subtree rooted at for the root of define top(rto be the point in (rwith maximum -coordinate for every other node vdefine top(rto be the point in with highest ycoordinate in (vthat is not also the highest -coordinate in ( )where is the parent of in (if such point existssuch labeling turns into priority search tree describe linear-time algorithm for turning into priority search tree implement this approach - one of the main applications of priority queues is in operating systems-for scheduling jobs on cpu in this project you are to build program that schedules simulated cpu jobs your program should run in loopeach iteration of which corresponds to time slice for the cpu each job is assigned prioritywhich is an integer between - (highest priorityand (lowest priority)inclusive from among all jobs waiting to be processed in time slicethe cpu must work on job with highest priority in this simulationeach job will also come with length valuewhich is an integer between and inclusiveindicating the number of time slices that are needed to process this job for simplicityyou may assume jobs cannot be interrupted--once it is scheduled on the cpua job runs for number of time slices equal to its length your simulator must output the name of the job running on the cpu in each time slice and must process sequence of commandsone per time sliceeach of which is of the form "add job name with length and priority por "no new job this slicep- develop python implementation of an adaptable priority queue that is based on an unsorted list and supports location-aware entries notes knuth' book on sorting and searching [ describes the motivation and history for the selection-sortinsertion-sortand heap-sort algorithms the heap-sort algorithm is due to williams [ ]and the linear-time heap construction algorithm is due to floyd [ additional algorithms and analyses for heaps and heap-sort variations can be found in papers by bentley [ ]carlsson [ ]gonnet and munro [ ]mcdiarmid and reed [ ]and schaffer and sedgewick [