Question: Question in computer science 5 . 1 Insertion: You are given two 3 2 - bit numbers, N and M , and two bit positions,
Question in computer science Insertion: You are given two bit numbers, N and M and two bit positions, i and j Write a method to insert M into N such that M starts at bit j and ends at bit i You can assume that the bits j through i have enough space to fit all of M That is if M you can assume that there are at least bits between j and i You would not, for example, have j and i because M could not fully fit between bit and bit EXAMPLEInput: NMquad ijOutput: NHints: # # #pg GrackingTheCodingInterview.com th EditionChapter Bit Manipulation Binary to String: Given a real number between and eg that is passed in as a double, print the binary representation. If the number cannot be represented accurately in binary with at most characters, print "ERROR."Hints: # # # # #pg Flip Bit to Win: You have an integer and you can flip exactly one bit from a to a Write code to find the length of the longest sequence of s you could create.EXAMPLEInput: or: Output: Hints: # # # # Next Number: Given a positive integer, print the next smallest and the next largest number that have the same number of bits in their binary representation.Hints: # # # # # # # #pg Debugger: Explain what the following code does: n&nHints: # # # # # # # # Conversion: Write a function to determine the number of bits you would need to flip to convert integer A to integer BEXAMPLEInput: quador: or: Output: quadHints: # # Pairwise Swap: Write a program to swap odd and even bits in an integer with as few instructions as possible eg bit and bit are swapped, bit and bit are swapped, and so onHints: # ### Draw Line: A monochrome screen is stored as a single array of bytes, allowing eight consecutive pixels to be stored in one byte. The screen has width w where w is divisible by that is no byte will be split across rows The height of the screen, of course, can be derived from the length of the array and the width. Implement a function that draws a horizontal line from xy to xyThe method signature should look something like:drawLinebyte screen, int width, int x int x int y Hints: # # # #pg Additional Questions: Arrays and Strings # # # Math and Logic Puzzles # Recursion # # Sorting and Searching ## C# Moderate Problems ## Hard Problems #Hints start on page Cracking the Coding Interview, th EditionMath and Logic Puzzlesocalled "puzzles" or brain teasers are some ofthe most hotly debated questions, and many companieshave policies banning them. Unfortunately, even when these questions are banned, you still may find
Step by Step Solution
There are 3 Steps involved in it
1 Expert Approved Answer
Step: 1 Unlock
Question Has Been Solved by an Expert!
Get step-by-step solutions from verified subject matter experts
Step: 2 Unlock
Step: 3 Unlock
