subject

We say that a sequence of numbers is a palindrome if it is read the same backward or forward. For example, the sequence: 6, 15, 6, 3, 47, 3, 6, 15, 6 is a palindrome.
Implement the following function:
def construct_a_longest palindrome(numbers_bank)
When given numbers_bank, a non-empty list of integers, it will create and return a list containing a longest possible palindrome made only with numbers from numbers_bank.
Notes:
1. The longest palindrome might NOT contain all of the numbers in the sequence.
2. If no multi-number palindromes can be constructed, the function may return just one number (as a single number, alone, is a palindrome).
3. If there is more than one possible longest palindrome, your function can return any one of them.
For example, if numbers_bank = [3, 47, 6, 6, 5, 6, 15, 3, 22, 1, 6, 15), Then the call construct_a_longest_palindrome (numbers_bank) could return: [6, 15, 6, 3, 47, 3, 6, 15, 6] (Which is a palindrome of length 9, and there is no palindrome made only with numbers from numbers_bank that is longer than 9).
Requirements:
1. You may use one ArrayQueue, one ArrayStack, and one ChaniningHash TableMap.
2. Your function has to run in expected (average) linear time. That is, if numbers bank is a list with n numbers, your function should run in O(n) average case.
3. Besides the queue, stack, hash table, and the list that is created and returned, you may use only constant additional space. That is, besides the queue, stack, hash table, and the returned list, you may use variables to store an integer, a double, etc. However, you may not use an additional data structure (such as another list, stack, queue, etc.) to store non-constant number of elements.

ansver
Answers: 3

Another question on Computers and Technology

question
Computers and Technology, 22.06.2019 19:30
Avariable definition defines the name of a variable that will be used in a program, as well as
Answers: 3
question
Computers and Technology, 23.06.2019 03:50
Iam a bacterium. i cause stomach cramps and diarrhea. i am caused by eating rotten foodssuch as chicken, fish, or eggs. sometimes turtles carry my bacteria.what am i?
Answers: 2
question
Computers and Technology, 23.06.2019 05:00
In cell b18, enter a formula to calculate the amount budgeted for meals. this amount is based on the daily meal allowance and the total travel days (# of nights+1).
Answers: 1
question
Computers and Technology, 23.06.2019 12:00
If you embed a word table into powerpoint, what happens when you make edits to the embedded data? a. edits made to embedded data change the data in the source file; however, edits made to the source file will not be reflected in the embedded data. b. edits made to embedded data will change the data in the source file, and edits made to the source file will be reflected in the embedded data. c. edits made to embedded data don't change the data in the source file, nor will edits made to the source file be reflected in the embedded data. d. edits made to embedded data don't change the data in the source file; however, edits made to the source file will be reflected in the embedded data.
Answers: 1
You know the right answer?
We say that a sequence of numbers is a palindrome if it is read the same backward or forward. For ex...
Questions
Questions on the website: 13722362