4,493
questions
0
votes
0
answers
23
views
How can we access the index of an elements in numpy array? [duplicate]
import numpy as np
np_arr = np.array([[1, 2, 3], [4, 5, 6]])
condition = (np_arr > 2) & (np_arr < 5)
print(condition)
When we print(condition) - we get a boolean array which tells ...
0
votes
0
answers
16
views
What is meant by Static Dispatch Restrictions?
So, I was going through LLVM-MCA and trying to understand the different metrics/views that it provides. As part of the extra statistics that MCA provides, I came across the Dynamic Dispatch Stall ...
-3
votes
0
answers
35
views
Having trouble getting correct answer when finding volume of a pyramid with user inputed data [closed]
i keep getting half of what the volume should be and cant figure out why can anybody help me with this. this is the coding im using:
public class PyramidVol {
/**
* @param args the command line ...
-2
votes
0
answers
14
views
Confusion with StorageRoot's definition in the Ethereum Yellow Paper [closed]
I am doing my undergrad thesis on Mathematical Modelling of Blockchain systems. For modelling Ethereum, I am required to understand and summarise the Ethereum Yellow Paper, but got stuck in this part ...
0
votes
1
answer
81
views
Is there only one way to create RBT on a paper with a given sequence of numbers?
Let's say I have sequence of random numbers that vary <1, 30>, e.g. 20, 23, 27, 15, 14, 13, 2.
Is there only one way to develop a Red-Black Tree on a paper? (i.e during exam). I mean I choose ...
-1
votes
1
answer
45
views
Genetic Algorithm with constraints on genes
I have a really big (exponential) search space for a problem, and as such i've been attempting to use genetics/evolution to find the approximate best solution, however I'm extremely inexperienced on ...
0
votes
0
answers
33
views
Intel processors risc or cisc? [closed]
Current Intel processors, such as i7 or i9, utilize which type of instruction set, RISC or CISC?
I'm trying to understand the architecture behind Intel processors. Historically, Intel's x86 processors ...
-5
votes
0
answers
31
views
I just need to execute some SQL [closed]
I am attempting to execute a Sql file for schoolwork. I do not need a connection, just let me execute the code without needing it. I'm on Apple Silicon, and all the assignments have us use Microsoft ...
0
votes
0
answers
64
views
Substitution method of integration in python without use of external packages
I am trying to calculate the integral of the attached image integral from 0 to infinite of 1 / ((1 + x) * sqrt(x))dx. I know this value is equal to pi. I must also print out the result to the ...
-1
votes
2
answers
159
views
Why don't decimal-floating-point numbers have CPU level support like float point numbers in personal computers? [closed]
In languages where Decimal exists (C#, Python), it is slower than float/double because it is not supported at the hardware level. So why don't decimal-floating-point, have hardware implementation ...
0
votes
1
answer
33
views
Clarification on "each digit represents an increasing power of 10" in number representation
I'm trying to understand a statement I came across: "each digit represents an increasing power of 10." This seems unclear to me because, from my understanding, each digit itself does not ...
1
vote
0
answers
196
views
What is the most efficient way to figure out if a single number is prime for numbers from 2 up to 2,147,483,647 in Java? [migrated]
As Java programmers, we can always use the BigInteger isProbablePrime() method or store manually all prime numbers in a HashMap. This question is about the most efficient way to figure out if a single ...
0
votes
0
answers
50
views
Poor performance when working with DMatrix in nalgebra
I'm trying to write a basic neural network in Rust using nalgebra, and it is very very slow; even slower than the Python version. Training the network on 60000 28x28 pixel images takes over 10 minutes ...
0
votes
3
answers
76
views
Time complexity analysis of data structures
I got a bit confused about analzsis of data structure basic operation like inserting or deleting.
when I am asked about creating an data structure that support deleting operation, or inserting in O(1),...
-1
votes
2
answers
102
views
Comparing array sums with recursion
I had the following exam question in an intro to a CS course. I could not think of a proper solution for this.
Write a function in C that accepts two arrays, arr1 and arr2, and their common size, ...
0
votes
1
answer
71
views
CS50 PSet 7 Movies (9.sql )
Why this code doesn't work? It should output 19.325 rows. I only get 4 rows. Meanwhile, it worked well when I used JOIN
SELECT DISTINCT name
FROM people
WHERE id IN
(
SELECT person_id
FROM ...
1
vote
0
answers
45
views
File corruption after file copying using python, how to fix it?
The following code is used:
Python
import os
import shutil
def backup_files(src_dir, dest_dir):
for root, dirs, files in os.walk(src_dir):
for file in files:
src_file = os....
1
vote
0
answers
93
views
Integer solutions for equation with approximated real variable
I'm trying to solve an equation of the kind:
f1(x)*m^2 + f2(x)*m*n + f3(x)*n = 0.
f1, f2, f3 are known linear functions with rational coefficients, x is inside the closed known interval [x_0, x_1] of ...
-1
votes
1
answer
50
views
Does stack work differently in assembly than how it works in C?
I just started learning assembly code. As far as I understand, when a functions calls in assembly code, the main variables are stored to stack from registers and stored back to registers after ...
0
votes
0
answers
27
views
In SR latch, how do we determine which input's output is considered in state table?
Case 1 - SR Latch using Nand Gate
Here the output from above gate's (taking S input) output is considered output of SR Latch
Case 2 - SR Latch using Nor Gate
Here the output from above gate's (taking ...
1
vote
0
answers
88
views
Maximum Sum of Vertices in DAG Excluding Directly Connected Vertices
How can I calculate the maximum possible sum of vertices in a weighted DAG excluding vertices directly connected by an edge? This is a vertex selection problem where each vertex has a weight.
In this ...
1
vote
1
answer
124
views
How to turn a 16-bit number in one's complement into it's 7-segment display equivalence?
I have a 16-bit integer, in one's complement, and I'm trying to retrieve it's 7-seg display equivalence. Using only bitwise operations.
I'm doing it for a Minecraft project/hobby, just trying to build ...
1
vote
0
answers
44
views
Determining the run time of an algorithm solving Latin Square
any help would be appreciated.
Here is the problem: https://erich-friedman.github.io/puzzle/latin/
Now, I write some code to solve the problem and want to find the time complexity of the problem, I ...
2
votes
1
answer
36
views
UML sequence diagrams: does creating a boundary automatically show it?
my colleagues and I are currently working on a university project about software engineering. At the moment, I am focusing on sequence diagrams and I have a few questions:
Is there a standard for ...
2
votes
0
answers
29
views
Allocate cores for a specific process
I want to allocate multiple cores to a specific process so that only that process runs on those cores. Neither Windows system nor anything else should use these cores.
Is there a way to do something ...
0
votes
0
answers
26
views
I Have Imagination of Futuristic Computing Scenarios. How Can I Get Involved?
I am currently a backend developer specializing in Java-oriented web services, with a bachelor's degree in Computer Science. After working for a few years, I have become deeply interested in diving ...
0
votes
0
answers
24
views
Is it ideal to use get_parent() in Godot to change player velocity, position, etc?
I'm using Godot to make a game and I have a player that can dash if he has dash ability.
Well, I've made the dash ability separately that is not within player.gd script, I'm accessing player from the ...
0
votes
0
answers
32
views
I can't import docx files in Outline Word From Powerpoint
Hello everyone I can't import docx files from slides from outline in Powerpoint. I use Windows and Office 365. Therre are only available .RTF files but not docx. Anyone could help me?
[enter image ...
0
votes
0
answers
30
views
Generating astronomically many strings
Is it possible to generate all possible 64-character strings using only the characters '0'-'9' and 'a'-'f' in any programming language?
The range mentioned represents an unsigned integer with an ...
0
votes
0
answers
21
views
Building Audio-to-image classification And make a best Architecture Model
How to Identified any specific applications or use cases for the audio to image classification model building?
I tried making Architecture Model Like CNN but It cant predict The image, I expected ...
0
votes
0
answers
59
views
Minimum path cost of a directed weighted graph with cycles maximizing the number of visited nodes
Couldn't find any similar question asked before so here I go:
I'm working with JAVA but any pseudo-code will be more than welcome.
Given:
Graph G directed, weighted and with cycles.
Set of V vertices....
0
votes
0
answers
21
views
How can i get the mask from contours to apply skeltonization
enter image description hereBelow is an image containing road contours. I want to apply skeletonization, but I'm getting poor results. So, I thought of first obtaining the mask from the contours and ...
0
votes
1
answer
67
views
How to simplify these clauses into implications for an implication graph?
For a uni project I have to create an implication graph from clauses.
For example, from the clause (a or b), I can determine these implication :
¬a -> b
¬b -> a
but I really can't find the ...
1
vote
1
answer
59
views
I can't understand machine epsilon arithmetic
I know that arithmetic operations whose result is close to zero can sometimes be non-associative. This follows directly from the definition of machine epsilon. however, I decided to test another ...
0
votes
1
answer
98
views
Why do I keep getting a Valgrind set address range perms warning in my code?
I don't see what I could possibly be doing wrong to keep getting this valgrind error. I'm not leaking any memory..
In my project, I have to implement a graph, a fundamental graph algorithm, and have a ...
0
votes
1
answer
41
views
Longest common subsequences, error when running code
`Here are the code and the error. I am not sure what to do for the declare any desired classes.
Traceback (most recent call last):
File "/home/runner/local/submission/main.py", line 149, in ...
0
votes
0
answers
18
views
Convolutional autoencoder from Mel spectogram . Does not work
enter image description here
# Convert list to a numpy array
data_array = np.array(data_list, dtype='float32')
data_array = np.array(data_array, dtype='float32') / 255.0 # so my data is from 0 to 1
...
0
votes
0
answers
37
views
For the polos and jumpers categories when I press it the items stored underneath they don't appear. How would I fix this issue?
class BuyItemPage:
def __init__(self, master):
# Existing code...
# Create a Treeview widget
self.treeview = ttk.Treeview(master)
self.treeview.pack(expand=True, ...
1
vote
1
answer
126
views
How to count cul-de-sacs (aka dead-ends) in a maze using Python?
Problem Statement
I am working on a maze-solving program where I need to count the number of cul-de-sacs, also known as dead-ends. The maze is represented in a way that allows identifying different ...
0
votes
0
answers
23
views
Finding max flow in a network while optimizing distribution of extra resources
How to find the maximum flow in a network where a subset of the edges must sum to a given total cost?
Consider the following example:
Given a network containing n nodes describing fuel stations, ℓ ...
0
votes
0
answers
8
views
Is it possible to found a optimal polynomial-time solvable algorithm for graphs with 2 disjoint path of 4 vertices?
Currently, i am working on developing algorithm for graphs with 2P4(2 disjoint path of 4 vertices).
However, i found that most of the research paper working on H-free graph, recently have a paper like ...
1
vote
1
answer
55
views
Why does bit vector a = [01101001] encode set A = {0, 3, 5, 6}?
I'm reading Computer Systems: A Programmer's Perspective and I don't understand why does bit vector a = [01101001] encode set A = {0, 3, 5, 6}?
I did some googling but haven't find anything useful. I'...
0
votes
0
answers
178
views
How can I stop karel from moving after it has completed putting the beepers in the entire world. It works perfectly for all worlds but doesnt stop
This is my code for the fill karel question. The bot works perfectly and fills all places perfectly but it gets stuck in an infinite loop in the upper shelf or encounters a runtime error
def main():
...
0
votes
0
answers
25
views
what's the difference between "nn layout" and "nt layout"
I have some questions about some concepts, and they are not well solved through search engines and gpt, so I hope you can explain them to me.
I don't understand "nn layout" and "nt ...
0
votes
1
answer
26
views
Theory of Comp Sci - State Diagrams NFAs
1.49 Theorem
Here is a correct example:
As here is an example for one that is correct:
prob_1_10c = NFA(
states={"q0", "q1", "q2"},
input_symbols={"0", &...
-1
votes
3
answers
135
views
How to test that a specific sorting algorithm was actually implemented?
I'm looking for an automated test to validate that merge sort was actually implemented. I know how to validate that a sorting algorithm actually sorts, but how do I validate that merge sort was used ...
1
vote
3
answers
93
views
Creating a more efficient algorithm for taking the third largest difference an element has with another element in the list in python
This is a programming problem activity from my university. I am going to modify the problem to avoid plagiarism.
Let's say you have n people in a group. For each person, we number them from 0 to n−1. ...
0
votes
1
answer
78
views
Theory of computer science problems
I am working on theory of computer science problems but cannot get these to work:
a. Give an NFA recognizing the language (01 ∪ 001 ∪ 010)*
b. Convert this NFA to an equivalent DFA. Give only the ...
2
votes
1
answer
97
views
Choosing a sequence of bitwise operations
Would it be possible to choose a sequence of bitwise operations on randomly generated 64-bit numbers such that the bits in the end result have a given probability of being set? My goal is to write a ...
-1
votes
1
answer
35
views
How to determine the time complexity of a recursive function that has a loop enclosed in it?
I am trying to solve LeetCode problem 143. Reorder List:
You are given the head of a singly linked-list. The list can be represented as:
L0 → L1 → … → Ln − 1 → Ln
Reorder the list to be on the ...