Concept explainers
def large_matrix(matrix: list[list[int]]) -> int:
"""
Returns the area of the rectangle in the area of a rectangle is defined by number of 1's that it contains.
The matrix will only contain the integers 1 and 0.
>>> case = [[1, 0, 1, 0, 0],
... [1, 0, 1, 1, 1],
... [1, 1, 1, 1, 1],
... [1, 0, 0, 1, 0]]
>>> largest_in_matrix(case1)
6""
You must use this helper code:
def large_position(matrix: list[list[int]], row: int, col: int) -> int:
a = row
b = col
max = 0
temp = 0
rows = len(matrix)
column = len(matrix[a])
while a < rows and matrix[a][col] == 1:
temp = 0
while b < column and matrix[a][b] == 1:
temp = temp + 1
b = b + 1
column = b
a = a + 1
if (a != row+1):
temp2 = temp * (a - row)
else:
temp2 = temp
if max < temp2:
max = temp2
b = col
return max
""" remember:
Please do this on python
you should not use any of the following:
- dictionaries or dictionary methods
- try-except
- break and continue statements
- recursion
- map / filter
- import""'
Step by stepSolved in 2 steps with 1 images
- Write a code segment that transfers items from a full array to a singly linked structure. The operation should preserve the ordering of the items. *PYTHONarrow_forwardstruct insert_at_back_of_sll { // Function takes a constant Book as a parameter, inserts that book at the // back of a singly linked list, and returns nothing. void operator()(const Book& book) { /// TO-DO (3) /// // Write the lines of code to insert "book" at the back of "my_sll". Since // the SLL has no size() function and no tail pointer, you must walk the // list looking for the last node. // // HINT: Do not attempt to insert after "my_sll.end()". // ///// END-T0-DO (3) ||||// } std::forward_list& my_sll; };arrow_forwardJava (LinkedList) - Grocery Shopping Listarrow_forward
- // pre: list != null, list.length > 0 // post: return index of minimum element of array public static int findMin(int[] list) { assert list != null && list.length > 0 : "failed precondition"; int indexOfMin = 0; for(int i = 1; i < list.length; i++) { if(list[i] < list[indexOfMin]) { indexOfMin = i; } } return indexOfMin; } Question: draw DFG from the code above find the all-def/c/p use paths. Generate test cases to test this function using JUnit! (to test all-def/c/p use path)arrow_forwardData Structure & Algorithm: Describe and show by fully java coded example how a hash table works. You should test this with various array sizes and run it several times and record the execution times. At least four array sizes are recommended. 10, 15, 20, 25. It is recommended you write the classes and then demonstrate/test them using another classarrow_forwardJAVA programming languagearrow_forward
- For any element in keysList with a value greater than 50, print the corresponding value in itemsList, followed by a comma (no spaces). Ex: If the input is: 32 105 101 35 10 20 30 40 the output is: 20,30, 1 #include 2 3 int main(void) { const int SIZE_LIST = 4; int keysList[SIZE_LIST]; int itemsList[SIZE_LIST]; int i; 4 6 7 8 scanf("%d", &keysList[0]); scanf ("%d", &keysList[1]); scanf("%d", &keysList[2]); scanf("%d", &keysList[3]); 10 11 12 13 scanf ("%d", &itemsList[0]); scanf ("%d", &itemsList[1]); scanf("%d", &itemsList[2]); scanf ("%d", &itemsList[3]); 14 15 16 17 18 19 /* Your code goes here */ 20 21 printf("\n"); 22 23 return 0; 24 }arrow_forwardJava coding Can you create a remove method that removes and returns an element from an index in an array? Thanks.arrow_forward6. the grade is under 20 which is outlier, remove it from the array list. 7. Print array list using System.out.println() 8. Use indexOf to print index of 80. 9. Use get function. 10. What is the difference between get and index of? 11. Print the values of the array list using Iterator class. 12.. Delete all the values of the array list using clear function. 13. Print all the values of the array after you execute clear using System.out.println(). what is the result of using clear function? 14. What is the shortcoming of using array List?arrow_forward
- T/F 25) If a is an ArrayList, we can say a.add(5); to add an integer to a.arrow_forwardQuestion 20 A list is a collection with additional index- and iteration- related operations. True False Question 21 O(N) is the order of growth execution time of the size operation when using the SortedArrayCollection class, assuming a collection size of N. True False Question 22 If N represents the number of elements in the list, then the index-based set method of the ABList class is O(1). True False Question 23 O(N) is the order of growth execution time of the remove operation when using the LinkedCollection class, assuming a collection size of N. True False Question 24 It is not possible to use an array to implement a linked list. True False Question 25 O(N) is the order of growth execution time of the remove operation when using the ArrayCollection class, assuming a collection size of N. True False Question 26 Our linked implementation of lists implements a bounded list. True False Question 27 O(N) is the order of growth execution time of the contains operation…arrow_forward
- 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