How to write a program to output multiple results
|
10-26-2020, 06:54 PM
Post: #9
|
|||
|
|||
RE: How to write a program to output multiple results
(10-26-2020 01:23 PM)pinkman Wrote: Yes good approach, but there is no flatten function on the Prime.We should request it ! I was looking at XCas source misc.cc, I discovered there is an undocumented flatten1 XCas> flatten1([1,2,3,[4,[5]]]) → [1,2,3,4,[5]] The code also explained why flatten is so fast. It only scan the list 1 time, adding 1 element at a time, with time complexity of O(n) We could emulate the functionality of flatten, but time complexity is O(n^2) Here is a simple implementation. (note that concat is needed, which kills performance.) Code: flat(lst) := { |
|||
« Next Oldest | Next Newest »
|
Messages In This Thread |
How to write a program to output multiple results - cloudxff - 10-25-2020, 03:52 AM
RE: How to write a program to output multiple results - pinkman - 10-25-2020, 06:47 PM
RE: How to write a program to output multiple results - cloudxff - 10-26-2020, 03:35 AM
RE: How to write a program to output multiple results - pinkman - 10-26-2020, 10:27 AM
RE: How to write a program to output multiple results - cloudxff - 10-26-2020, 11:32 AM
RE: How to write a program to output multiple results - Albert Chan - 10-26-2020, 12:49 PM
RE: How to write a program to output multiple results - pinkman - 10-26-2020, 01:23 PM
RE: How to write a program to output multiple results - Albert Chan - 10-26-2020 06:54 PM
RE: How to write a program to output multiple results - cloudxff - 10-27-2020, 04:55 AM
RE: How to write a program to output multiple results - StephenG1CMZ - 10-26-2020, 02:51 PM
|
User(s) browsing this thread: 4 Guest(s)