algorithm tag

168 questions


1 answers
129 views
0
I would like to ask you a question about analyzing the example code that implements the Dijkstra algorithm in Python. (Help me!!!))

graph = {}graph[start] = {}graph[start][a] = 6graph[start][b] = 2graph[a] = {fin: 1} # graph[a][fin] = 1graph[b] = {a: 3, fin: 5} # graph[b][a] = 3 graph[b][fin] = 5graph[fin] = {}# Hash table that st...


1 answers
131 views
0
To quickly raise the result of integer division in C/C++

I know that C/C++ always lowers the result of dividing int.I know that math.h has ceil(), but I want to know how to raise the header right away without including it.My code is inefficient by comparing...

2 years ago

1 answers
37 views
0
Questions about python algorithms.

https://www.hackerrank.com/challenges/python-mutations/problemThis is the question.The answer is def mutate_string(string, position, character): return string[:position] + character + string[position ...

2 years ago

1 answers
99 views
0
To pull a random item out of a set

How do I pull out random items in Set? I want to pick random elements from HashSet or LinkedSet, but I don't know how.


1 answers
39 views
0
To create all permutations of a given string.

What is the best code to make all permutations of a given string? For example, if we have ba, we have ba and ab, but how do we make a program that outputs all the permutations that might come out of a...

2 years ago

2 answers
35 views
0
Putting a zero before a number to match a digit

In JavaScript, I want to create a string that displays a certain number and puts a zero in front of it to match the digits.For example, How do I do that?

2 years ago

2 answers
42 views
0
Hello! I have an algorithm question.

It's the following question, but I don't know how to solve it.How should I solve it?Masters, please answer!

2 years ago

1 answers
68 views
0
C language tree algorithm

If I say that I have vertices A and B, I don't know how to make sure they're connected and how to write the source code... ㅠ

2 years ago

1 answers
43 views
0
I have a question when I make the program logic.

When creating a simple program, not a program in the textbook, we are studying and developing by using algorithms to create a mechanism that works inside and coding it.I'm asking you this question bec...

2 years ago

2 answers
68 views
0
[Changing the code] It's kotlin. How do I modify this code?

class Snapshot<T>(private val array:MutableList<T>) { fun restore():MutableList<T> { return array } }fun test2(){ var array = mutableListOf(1,2) val snap = Snapshot(array) array[0] ...

2 years ago
« - 16 - »

© 2024 OneMinuteCode. All rights reserved.