Task 4 Suppose you have a sitting arrangement of the students who will give the final exam in a list. The list contains the last two digits of their student ID as given below. sitting_list = [10,30,20,70,11,15,22,16,58,100,12,56,70,80] Now you want to organize the sitting arrangement of the students in your own way. You decide to sort all the students in the even indices of the list in ascending order and all the students in the odd indices of the list in descending order. So, write a python program that organizes the list for you in this way. Sample Output [10, 100, 11, 80, 12, 70, 20, 56, 22, 30, 58, 16, 70, 15]
Q: (g) get_total_crimes_by_type(adict, 2Dlist) takes a dictionary (crime_dict) and a 2D-list…
A: def get_total_crimes_by_type(adict, 2Dlist): total_crime = {} for i in adict: value =…
Q: I need to write changeArrayLength(int m) – void method; I already have the code (attached below) but…
A: the answer is given below:-
Q: Write a program segment to calculate the total price of all products in the linked list. Note that,…
A: I have given an answer in step 2.
Q: Write a line of code in R that will change the Location column of the tibble in my_Costco_list to an…
A: R is а рrоgrаmming lаnguаge fоr stаtistiсаl соmрuting аnd grарhiсs thаt yоu саn use tо…
Q: what allows ADT List to accept any specific object, but once selected, only that object can be added…
A: According to the information given:- We have to define ADT List to accept any specific object, but…
Q: Question 11 If N represents the number of elements in the collection, then the contains method of…
A: As for our rules we can answer one question at a time please post remaining questions separately.…
Q: Task 2 Suppose you have a list named my_list as given below. my_list =…
A: Implement Selection Sort using Python programming language. Input: my_list =…
Q: True or False For each statement below, indicate whether you think it is True or False. If you…
A: Given the following statement we have to answer in True or False.
Q: Task 3 Suppose you have a list named my_list as given below…
A: Using Python, the given list is sorted in descending order below for which an explanation is also…
Q: (b) Write a program to create a linked list of Car where each Car node will contain the following…
A: Given:
Q: A sorted list of numbers contains 200 elements. Which of the following is closest to the maximum…
A: The worst case time complexity of binary search algorithm is ceil (log 2 n) Here n=200
Q: 1. You are given N number of intervals, where each interval contains two integers denoting the start…
A: The current scenario here is to merge the overlapping intervals. An interval is represented as a…
Q: Merge sort and Quick to sort the list,
A: Given :- In the above question a list is mention in the above given question Need to apply the…
Q: True or False
A: Given statements true or false
Q: tasks needed to efficiently find page 70 in a 200-page book from first (1) to last (4). Gelect your…
A: Here we have to efficiently find page 70, for this we use binary search algorithm. For that start…
Q: What is the output of following function for start pointing to first node of following linked list?…
A: 1 3 5 5 3 1
Q: There are some differences between the linked list and the array but the main difference between the…
A: There are some differences between the linked list and the array but the main difference between the…
Q: Task 1 Suppose you have a list named my_list as given below. ny_list =…
A: Given list is my_list= [10,1,20,3,6,2,5,11,15,2,12,14,17,18,29] Now use bubble sort to sort my_list…
Q: If a sorted list has elements numbers 0 to 50 and the item being searched for happens to be at…
A: Introduction: Here we are required to tell how many times will our find() function will be called if…
Q: True or False For each statement below, indicate whether you think it is True or False. provide a…
A: - The question is to highlight the correct option for the priority queue shown in the form of code.…
Q: Suppose you have a table t with a column labeled 'XYZ. What is the difference between t.YYZ.cumsum()…
A: Answer: For each row of the table t.YYZ.cumsum() sum of the all values of the column XYZ. For each…
Q: Suppose a list named listExample has six letters, length of listExample is :
A: The program includes directions for solving the problems and outputs the results. The program's…
Q: what point is it appropriate to build an index by hand
A: Here have to determine about doing index by hand.
Q: If the second parameter exists in the first list parameter, return the index of the first occurrence…
A: Iterate over a list Return the index if element is found Return -1 if element not found
Q: 9) The “head” pointer of this list is pointing to Node 4 10) If we called “insert(5)”, the new…
A: 9) The “head” pointer of this list is pointing to Node 4 4 is the last node whereas head is the…
Q: Your task is to complete the five individual functions for adding and deleting terms, looking up…
A: The complete Python code is given below with screenshots
Q: I have 2 lists lets just say: a = [1,2,3,4,5] b = [1,2,3,4,5] both lists have related data like a…
A: The logic that is going to use here is:- find maximum in b array and get the index of maximum…
Q: Assume the list is sorted by one of the comparison sorts. And after some iterations the list…
A: Explanation: Bubble sort: The bubble Sort sorting algorithm works by repeatedly swapping the…
Q: When a new node is inserted into an array based list at an index, which of the following is FALSE?…
A: When a node is inserted into array based list at an index
Q: Task 6 Suppose you have a list named my_list as given below. Your task is to sort the list in…
A: NOTE - As per our guideline we are supposed to solve only one question, please repost other parts as…
Q: CHALLENGE 6.1.1: Modify a list. ACTIVITY Modify short_names by deleting the first element and…
A: To remove elements from list use pop function. len(list) return the length of list so use it to…
Q: I have tried this a few times and cannot figure it out. This is for python.
A: The sub lists can be printed by printing each row; hence the answer would be:for i in…
Q: How many references must you change to insert/delete a node in a single/double linked list? What are…
A: Linked list is a data structure and it contains data and pointers to next nodes. Given types of the…
Q: Make Link list by displaying 0 9 0 7 2 0 0 1 and then perform addition and deletion functions.
A: We are going to solve this problem in Java Language as the programming language is not mentioned. We…
Q: What would be the range of index values for a list of 13 elements?
A: Program in pyhton: # Python index List Function intIndexList = [] number = int(input("Please enter…
Q: Task 14 Given a list of tuples, your task is to multiply the elements of the tuple and return a list…
A: Given:
Q: I need to write changeArrayLength(int m) – void method; I already have the code (attached below) but…
A: For the implementation of the above requirement, first we create an array of size m and initialize…
Q: How many references must you changes to insert a node between two nodes in a double linked list.…
A: A linked list is a linear type of data structure. It is used when the requirement of data storage is…
Q: When an author produces an index for his or her book, the first step in this process is to decide…
A: Actually, program is an executable software that runs on a computer. c++ is a powerful general…
Q: We use the CUSTOMER table as an example: Phone California 11111111 Customerld CustomerNumber…
A: The question is write SQL code for the given problem.
Q: Given a nested list named NxN_table that represents a table with N rows and N columns, print each…
A: Following Variables and functions has been used to solve this diagonal problem:Variables: N, i,…
Q: True or False
A: Defined true and false if the given statements
Q: this is for python
A: Program descriptionTwo lists are created one is a 3 x 3 list and the other 4 x 4 to demonstrate the…
Q: Task 5 Suppose a list contains marks earned in the courses CSE110, PHY111, and MAT110 of each…
A: The answer is given below:-
Q: Task 4 Suppose you have a sitting arrangement of the students who will give the final exam in a…
A: Python program where we are creating a user input list from the student sitting_list arrangement and…
Q: Which of the following statements regarding linked lists and arrays is correct? Group of answer…
A: Option e: e. If many deletions at any place in the structure were common, a linked list…
Q: True or False For each statement below, indicate whether you think it is True or False. If you…
A: Below are the answers with reason:
Q: Create a digit rearrangement function for each numerical item in a list based on ascending or…
A: Here, The function name is reorderDigits which is taking two arguments, List of Numbers and…
Must show it in Python:
Please show step by step with comments.
Please show it in simplest form.
Input and Output must match with the Question
Please go through the Question very carefully.
Trending now
This is a popular solution!
Step by step
Solved in 2 steps with 2 images
- def city_dict(adict): """ Question 6 -Given a dictionary that maps a person to a list of countries they want to travel to, return a dictionary with the value being the list sorted by the last letter in each countries name. If two countries have the same last letter, sort by the first letter. -For an extra challenge, try doing this in one line (Optional). Args: adict (dict) Returns: dict >>> city_dict({"Pablo": ["Belgium", "Canada", "Germany"], "Athena": ["Italy", "France", "Egypt"], "Liv": ["Japan", "Bolivia", "Greece"]}) {'Pablo': ['Canada', 'Belgium', 'Germany'], 'Athena': ['France', 'Egypt', 'Italy'], 'Liv': ['Bolivia', 'Greece', 'Japan']} >>> city_dict({"Jacob": ["Bahamas", "Brazil", "Chile"], "Lexi": ["Colombia", "Finland", "Panama"], "Emily": ["Ireland", "Russia", "Kenya", "Jordan"]}) {'Jacob': ['Chile', 'Brazil', 'Bahamas'], 'Lexi': ['Colombia', 'Panama', 'Finland'], 'Emily': ['Kenya',…Complete the docstring below, and use the helper functions attached if necessary: def check_syllable_counts(poem_lines: POEM, description: POETRY_FORM_DESCRIPTION, word_to_phonemes: PRONUNCIATION_DICT) \ -> List[POEM_LINE]: """Return a list of lines from poem_lines that do NOT have the right number of syllables as specified by the poetry form description, according to the pronunciation dictionary word_to_phonemes. If all lines have the right number of syllables, return the empty list. Precondition: len(poem_lines) == len(description[0]) >>> poem_lines = ['The first line leads off,', ... 'With a gap before the next.', 'Then the poem ends.'] >>> description = ((5, 5, 4), ('*', '*', '*')) >>> word_to_phonemes = {'NEXT': ('N', 'EH1', 'K', 'S', 'T'), ... 'GAP': ('G', 'AE1', 'P'), ... 'BEFORE': ('B', 'IH0', 'F',…How many references must you changes to insert a node between two nodes in a double linked list. Show your answer with a drawing highlighting the new references. Assuming current is the reference of the next-to-last node in a linked list, write a statement that deletes the last node from the list. What is the time complexity of deleting a node from a linked listed? Is it faster than deleting a node from an array? Why?
- True or False For each statement below, indicate whether you think it is True or False. If you like, you can provide a description of your answer for partial credit in case you are incorrect. Use the standard linked list below to answer True/False statements 9-12: 8 7 null 4 10 The “head” pointer of this list is pointing to Node 4 If we called “insert(5)”, the new node’s “next” pointer will point to Node 8 If we called “delete(10)”, Node 7’s “next” pointer will point to Node 8 If we called “search(20)”, the “head” pointer will be at Node 4 after the search function endsSuppose a list contains marks earned in the courses CSE110, PHY111, and MAT110 of each student consecutively in a nested list form. Your task is to take a course name as input and sort the list based on the marks obtained in that course to finally print the names of the students in descending order of marks obtained i.e. from the student who earned the highest marks to the student who earned the lowest. For example, the list may look like stu_lst = [ ["Alan", 95, 87, 91], ["Turing", 92, 90, 83], ["Elon", 87, 92, 80], ["Musk", 85, 94, 90] ] where for each nested list, 1st index holds the name of the student, 2nd index is total marks earned in the CSE110 course, 3rd index is PHY111 marks and 4th index is MAT110 marks. [You cannot use python build-in sort() function, you can call your own sort function or copy your code from previous tasks instead] =============================================================== Sample Input 1 MAT110 Sample Output 1 ['Alan', 'Musk', 'Turing', 'Elon']…Suppose a list contains marks earned in the courses CSE110, PHY111, and MAT110 of each student consecutively in a nested list form. Your task is to take a course name as input and sort the list based on the marks obtained in that course to finally print the names of the students in descending order of marks obtained i.e. from the student who earned the highest marks to the student who earned the lowest. For example, the list may look like stu_lst = [ ["Alan", 95, 87, 91], ["Turing", 92, 90, 83], ["Elon", 87, 92, 80], ["Musk", 85, 94, 90] ] where for each nested list, 1st index holds the name of the student, 2nd index is total marks earned in the CSE110 course, 3rd index is PHY111 marks and 4th index is MAT110 marks. [You cannot use python build-in sort() function, you can call your own sort function or copy your code from previous tasks instead] =============================================================== Sample Input 1 MAT110 Sample Output 1 ['Alan', 'Musk', 'Turing', 'Elon']…
- Need help with this: Given the following challenges, use append(), extend(), pop(), and insert()to change the contents of the lists. Suppose that we have the following list: Strawberry, Blueberry, Blackberry, Cranberry Define the list berries with the following elements shown in Snippet 5.11: Strawberry, Blueberry, Blackberry, Cranberry Using the built-in append() method, add the value Raspberry to the list berries. Using the built-in extend() method, extend an empty fruits list from the berries list that you created previously. Insert Mangoes into the fruits list at index 2 using the built-in method insert(). Remove the element at index 1 from the fruits list using the built-in method pop() and replace it with Apples, using the insert() built-in method. Finally, sort the elements in the fruits list by using the built-in method sort() with keyword arguments. Set the key argument to None and the reverse argument to False.Please check the instructions on the images given. Sample output are also given on the image while the code for modification is provided below. hash.c #include <stdlib.h>#include <stdio.h> struct Node { int val; struct Node * next;}; struct HashTable { int size; struct Node ** table;}; struct Node * create_node(int val);struct HashTable * create_table(int size);void destroy_table(struct HashTable * h);void display_table(struct HashTable *h);int hash_function(int key, int size);void insert(struct HashTable *h, int val);int search(struct HashTable * h, int val);struct Node * delete(struct HashTable * h, int val); void main(){struct HashTable * h = create_table(8);display_table(h); int val_insert[12] = {12, 31, 45, 83, 72, 29, 84, 39, 61, 24, 10, 50}; for (int i=0; i<12; i++) { insert(h,val_insert[i]);}display_table(h); int val_search[4] = {29, 99, 72, 20};for (int i=0; i<4; i++) { int result = search(h,val_search[i]); printf("Search value %2d:…From the code supplied by the tutor, modify it so that: 1. Ask what kind of animal it is (for example, carnivore, herbivore, and omnivore) When prompting for the information, it is saved in a list for each of the three animal types (for example, lions in carnivores, bears in omnivores, giraffes in herbivores) and they are saved depending on the number that the user adds in each list. 2. At the end, a list of lists is printed that presents the data of each of the saved animals according to their type.
- Answer properly What type of data is being stored into a list and identify the name of the list being processed. //Create variables//stores data from the dog table in listsvar dogList = getColumn("Dogs", "Name");var breedList = getColumn("Dogs", "Breed Group");var temperamentList = getColumn("Dogs", "Temperament"); var breedGroup = "";var tempGroup = "";var message = "";var message2 = ""; //Filtered listsvar filteredDogList = [];var filteredTemperamentList = []; //Filtered list to filter filteredDogListvar filteredDogList2 = []; //Button to filter the dogs by breed and takes you to the next screen that displays the filtered dogsonEvent("nextButton", "click", function( ) {breedGroup = getText("breedDropdown");setScreen("dogTypesScreen");filter();updateScreen1();}); //Button to sort the filtered dogs by temperament and takes you to the next screen that displays themonEvent("temperamentButton", "click", function( ) {tempGroup =…import json, datetime, csvfrom pprint import pprint Question 3 - Using the cleaned list of lists from question 1, create a dictionary of dictionaries where each key in the outer dictionary is an author whose last name starts with the letter 'S'. - Each inner dictionary should contain the number of books that author has written as 'Number of Books' - It should contain the earliest book title for that author based on year with the key 'First Book' - Finally it should contain the latest book title for that author based on year with the key 'Last Book' - If an author has only one book put the same title in both places - Return the dictionary of dictionaries def author_history(cleaned_list): Args: cleaned_list (list) Returns: dictionary of dictionaries Output: {'SafranFoer,Jonathan': {'First Book': 'ExtremelyLoudandIncrediblyClose', 'Last Book': 'ExtremelyLoudandIncrediblyClose',…Write a line of code in R that will change the Location column of the tibble in my_Costco_list to an ordered factor where the order of the levels is in the following order: Clothes, Cereal, Refrigerated. Then write a line of code using the previous line to compute the minimum amount of items (not the number of different items) required in each location. my_Costco_list <- list(tibble(Item = c("Milk", "Coffee", "Lettuce","Pants"),Amount = c(4,1,2,2),Location = c("Refrigerated","Cereal","Refrigerated","Clothes")))