EBK DATA STRUCTURES AND ALGORITHMS IN C
4th Edition
ISBN: 9781285415017
Author: DROZDEK
Publisher: YUZU
expand_more
expand_more
format_list_bulleted
Expert Solution & Answer
Want to see the full answer?
Check out a sample textbook solutionStudents have asked these similar questions
Using a csv file attached (https://file.io/NMvbdnv4E3r0), Create a program on python that use the csv file. The program should accept a user's input of a compound. It should output the molar mass (in 2 decimal places only) of the compound.by using the csv file to compute for the atomic mass at name of the elements. Furthermore, if the "elements involved" are wrong an invallid message should be outputted and only existing chemical symbols are the output. The same goes for wrong input of the "number of atoms" wherein a wrong an invallid message should be outputted and only integers are to be inputted by the user.
Program should look like this:
Enter compound: C6H12O6
Enter elements involved: C,H,O
Enter no. of Carbon atoms: AA
Enter no. of Hydrogen atoms: 12
Enter no. of Oxygen atoms: 6
Wrong input of number of atoms! Try again.
or
Enter compound: C6H12O6
Enter elements involved: C,H,O
Enter no. of Carbon atoms: 6
Enter no. of Hydrogen atoms: 12
Enter no. of Oxygen atoms: 6…
Implement RSA algorithm, without using existing libraries.
Your program takes as input a file with the following information, your input file, it will be named
input_rsa.txt:
a key K (public key if the a=0, and private key if a=1)
an input x
an integer a of value 0 indicating encryption, and value 1 indicating decryption
Implement the"paint fill"function that one might see on many image editing programs. That is, given a screen (represented by a two-dimensional array of colors), a point, and a new color, fill in the surrounding area until the color changes from the original color.
Chapter 12 Solutions
EBK DATA STRUCTURES AND ALGORITHMS IN C
Knowledge Booster
Similar questions
- A common memory matching game played by young children is to start with a deck of cards that contain identical pairs. For example, given six cards in the deck, two might be labeled 1, two labeled 2, and two labeled 3. The cards are shuffled and placed face down on the table. A player then selects two cards that are face down, turns them face up, and if the cards match, they are left face up. If the two cards do not match, they are returned to their original face down position. The game continues until all cards are face up. Write a program that plays the memory matching game. Use 16 cards that are laid out in a 4 4 square and are labeled with pairs of numbers from 1 to 8. Your program should allow the player to specify the cards that he or she would like to select through a coordinate system. For example, in the following layout: 1 2 3 4 1 8 * * * 2 * * * * 3 * 8 * * 4 * * * * all of the face down cards are indicated by *. The pairs of 8 that are face up are at coordinates (1,1) and…arrow_forwardImplement the first round of AES ( Advanced Encryption Standard ) in python. Given a message with 128 bits, two subkeys subkey0 and subkey1, your program should be able to perform one AddKey before Round 1 and the corresponding operations (SubBytes, ShiftRows, Mix-Columns, and AddKey) in Round 1, and output the result of the encryption after Round 1.arrow_forwardTry to do it fast. 7. Given, only a single array of size 10 and no other memory is available. Which operation is not feasible to implement (Given only push and pop operation)?arrow_forward
- please code in python Find the expanded DNA strand: this is the opposite of the compression technique described in 3. So, it basically undoes the compressing. For example, CAGGTTT is the expanded form of CA2G3T, TATTGC is the expanded form of TA2TGC, and TAGC is the expanded form of TAGC.arrow_forwardA palindrome is a sequence that is the same as its reverse. For example, the word "RACECAR" is a palindrome. For this problem we will define an almost palindrome to be a sequence that can be transformed into its reverse with 2 or fewer character additions, deletions, replacements, or swaps. A character swap swaps two adjacent characters. For instance "MARJORAM" can be reversed by swapping the 'J' and the 'O'. In addition, "FOOLPROOF" can be reversed by replacing the 'R' with and 'L' and vice versa. Finally, the word "BONOBO" can be reversed by deleting the final 'O' and reinserting it at the beginning. Devise a dynamic programming algorithm that will determine the number of edits necessary to to transform a sequence into its reverse. a) State this problem with formal input and output conditions. b) State a self-reduction for this problem. c) State a dynamic programming algorithm based off of your self-reduction that computes the minimum number of edits to transform a sequence into its…arrow_forwardHow do I SUM a list of float? as the output of the previous script, I have this [-0.004894362613156397] [-0.005284630990696516] [-0.39715504708587857] [-0.23893503091440427]... (the floats are calculated potential energy between two atoms in a system of multiple atoms) basically a list of many floats, all in separate rows. I have been searching method to SUM all the float element so that I can end up with a single number ( sum = x), but I have not find anything that works. Can you please help finding a way? the following script is what generates the list abovearrow_forward
- Your aim is to determine the largest k numbers among n numbers stored in a text file with one number per line.(n >> k). However, we can only read n numbers from the file line by line, ie one by one, we do not have the possibility to read and store them all at once. Under these circumstances, implement the algorithm, which finds and returns k numbers with the largest value for a given value of k out of n numbers in the file, in a programming language of your choice. Your algorithm's timecomplexity should be better than O (nk).arrow_forwardThe Reflection algorithm can be used to encrypt a C-string (character array terminated with the null character) before it is transmitted over the Internet. The Reflection algorithm works as follows: Each letter in the message is converted to the letter in that is 13 positions to the right of that letter in the English alphabet. If the end of the alphabet is reached, counting continues from the first letter in the alphabet. The case of the letters must be maintained. For example,'M' →'Z', 'x' → 'k', 'A' → 'N'The numeric characters ('0' to '9') are shifted 5 positions to the right of that number in the character set '0' to '9'. If ‘9’ is reached, counting continues from ‘0’. For example,'0' → '5', '2' →'7', '8' → '3' All other characters are left as they are. a) What would the following string be encrypted to by the Reflection algorithm?“Call me at 662-2002 Ext 85393” b) Write a function, getPosition, which finds the position of a letter in the alphabet regardless of the case of the…arrow_forwardWrite a script (Python) for least squares l2 that can receive either: a 2D point cloud. Let the program load an ASCII txt file with the data in two columns, as appropriate. The number of points is arbitrary. In addition, display a graph with the cloud of points and the approximate line, together with the error made.arrow_forward
- Write python code to find the submatrix. Thank you in Advance. You are given a 2D matrix that is filled with 1's in almost all the cells. However, there may be at most one rectangular submatrix that is filled with 0s. Implement an algorithm to return the size of the submatrix, in terms of width and height. Examples: Input: [[1,1,1,1,1,1,1], [1,1,1,1,1,1], [1,1,0,0,0,1], [1,1,0,0,0,1], 11,1,1,1,1,1]] Output: [3,2] (Because the width of the sumbmarix 3, and highets 2 Input: [[1,1,1,1], [1,1,1,1], [1,1,1,1]] Output: [0,0] (Because the there is no submatrix that contains 0s) Input: [[1,1,1,1], [1,1,0,1] [1,1,1,1]] Output: [1,1] (Because the width of the submatrix of 0s is 1, and height is 1)arrow_forwardEncryption Matrices are commonly used to encrypt data. Here is a simple form such an encryption can take. First, we represent each letter in the alphabet by a number, so let us take = 0, A = 1, B = 2, and so on. Thus, for example, "ABORT MISSION" becomes [1 2 15 18 20 0 13 9 19 19 9 15 14]. To encrypt this coded phrase, we use an invertible matrix of any size with integer entries. For instance, let us take A to be the 3 2 2 x 2 matrix 4 1 We can first arrange the coded sequence of numbers in the form of a matrix with two rows (using zero in the last place if we have an odd number of characters) and then multiply on the left by A. 3 2 1 15 20 13 19 9 14 Encrypted Matrix = 4 1 2 18 0 9. 19 15 0 7 81 60 57 95 57 42 = 6 78 80 61 95 51 56 which we can also write as [7 6 81 78 60 80 57 61 95 95 57 51 42 56]. To decipher the encoded message, multiply the encrypted matrix by A1. The following exercise uses the above matrix A for encoding and decoding. Use the matrix A to encode the phrase "GO…arrow_forwardC programming Implement an encoder. When completed, your program should be able to accept a short sentence from the user and display an encrypted version of it. For simplicity, let us assume one case of letters throughout, say CAPITALS. We can use a substitution method to scramble a sentence and then use the reverse of this process to recover it. If we take two rows of the alphabet and shift the bottom row along a specified amount (our key), we can then read the letters in our sentence from the top row and use the substituted letter from the bottom row to form the encrypted sentence. A B C D E F G H I J K L M N O P Q R S T U V W X Y Z X Y Z A B C D E F G H I J K L M N O P Q R S T U V W In the example above, the key is 3, hence the second row is shifted by three characters along. Take, for instance, the sentence “HELLO”. Each letter of your message should be replaced by the letter in the alphabet that comes three letters before. For “HELLO” that would be: EBIIL Your program is required…arrow_forward
arrow_back_ios
SEE MORE QUESTIONS
arrow_forward_ios
Recommended textbooks for you
- Database System ConceptsComputer ScienceISBN:9780078022159Author:Abraham Silberschatz Professor, Henry F. Korth, S. SudarshanPublisher:McGraw-Hill EducationStarting Out with Python (4th Edition)Computer ScienceISBN:9780134444321Author:Tony GaddisPublisher:PEARSONDigital Fundamentals (11th Edition)Computer ScienceISBN:9780132737968Author:Thomas L. FloydPublisher:PEARSON
- C How to Program (8th Edition)Computer ScienceISBN:9780133976892Author:Paul J. Deitel, Harvey DeitelPublisher:PEARSONDatabase Systems: Design, Implementation, & Manag...Computer ScienceISBN:9781337627900Author:Carlos Coronel, Steven MorrisPublisher:Cengage LearningProgrammable Logic ControllersComputer ScienceISBN:9780073373843Author:Frank D. PetruzellaPublisher:McGraw-Hill Education
Database System Concepts
Computer Science
ISBN:9780078022159
Author:Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Publisher:McGraw-Hill Education
Starting Out with Python (4th Edition)
Computer Science
ISBN:9780134444321
Author:Tony Gaddis
Publisher:PEARSON
Digital Fundamentals (11th Edition)
Computer Science
ISBN:9780132737968
Author:Thomas L. Floyd
Publisher:PEARSON
C How to Program (8th Edition)
Computer Science
ISBN:9780133976892
Author:Paul J. Deitel, Harvey Deitel
Publisher:PEARSON
Database Systems: Design, Implementation, & Manag...
Computer Science
ISBN:9781337627900
Author:Carlos Coronel, Steven Morris
Publisher:Cengage Learning
Programmable Logic Controllers
Computer Science
ISBN:9780073373843
Author:Frank D. Petruzella
Publisher:McGraw-Hill Education