Welcome, Guest: Register On Nairaland / LOGIN! / Trending / Recent / New
Stats: 3,152,482 members, 7,816,140 topics. Date: Friday, 03 May 2024 at 06:22 AM

Thread For Nairaland Algorithm Questions - Programming (5) - Nairaland

Nairaland Forum / Science/Technology / Programming / Thread For Nairaland Algorithm Questions (5404 Views)

Public API For Nairaland / What Is Nairaland Algorithm? / A Thread For Tutorial On Python Programming (2) (3) (4)

(1) (2) (3) (4) (5) (Reply) (Go Down)

Re: Thread For Nairaland Algorithm Questions by sharrp: 2:45pm On Jul 04, 2021
Deicide:
Correct but this code would be very slow & again Python is is a very slow language

Who told you python is a very slow language ? People come out here an say anything they read online
Re: Thread For Nairaland Algorithm Questions by sharrp: 2:52pm On Jul 04, 2021
Brukx:
It's not an integer, but it's definitely a number.
Bro in set of real and natural numbers no number begins with 0 that isn’t followed by a decimal point
Re: Thread For Nairaland Algorithm Questions by Deicide: 3:22pm On Jul 04, 2021
do you want to see benchmark compared to other language?
sharrp:


Who told you python is a very slow language ? People come out here an say anything they read online
Re: Thread For Nairaland Algorithm Questions by JFOD: 11:37pm On Jul 04, 2021
How can one generate a sub list of a list efficiently.

List = [1, 2,3]

sub_list = [ [1], [1,2] , [2] , [2,3], [3] , [1,2,3]]

My solution


for i in range(len(lst) + 1):
for j in range(i):
sub = lst[j: i]


Is there a more efficient method to do this?
Re: Thread For Nairaland Algorithm Questions by cyrielo(m): 6:54pm On Sep 24, 2021
cbrass:
Write a function Priority Queue that priotizies node target
eg

function prioritize_nodes($tree, $target_val) {
}


Hint: The target node will move up even if is in a child node.
I have a solution for this in JavaScript, will probably like a feedback if you’re interested
Re: Thread For Nairaland Algorithm Questions by cbrass(m): 9:05pm On Sep 24, 2021
cyrielo:

I have a solution for this in JavaScript, will probably like a feedback if you’re interested
okay can I see it, though I prefer php

(1) (2) (3) (4) (5) (Reply)

Programming Challenge: Convert String to Json with a Loop / List Of Failed Software Projects - What Went Wrong? / Discover How To Be A Blockchain Developer & Blockchain Engineer

(Go Up)

Sections: politics (1) business autos (1) jobs (1) career education (1) romance computers phones travel sports fashion health
religion celebs tv-movies music-radio literature webmasters programming techmarket

Links: (1) (2) (3) (4) (5) (6) (7) (8) (9) (10)

Nairaland - Copyright © 2005 - 2024 Oluwaseun Osewa. All rights reserved. See How To Advertise. 7
Disclaimer: Every Nairaland member is solely responsible for anything that he/she posts or uploads on Nairaland.