Skip to main content

All Questions

Tagged with
Filter by
Sorted by
Tagged with
1 vote
0 answers
27 views

Optimizing search algorithm for guessing list of strings via function returning bool if substring is in list [duplicate]

I trying to figure out the most effective way to accomplish this task: A function, check(), contains a list of strings. Calling the function with a string as ...
user avatar
2 votes
3 answers
384 views

Most effective search algorithm for guessing list of strings via function returning bool if substring is in list using Python

I trying to figure out the most effective way to accomplish this task: A function, check(), contains a list of strings. Calling the function with a string as ...
n0k's user avatar
  • 21
6 votes
1 answer
146 views

Implementation and Testing of Exponential Search for scenario where we search the same array/list many times

Exponential Search is an optimization over binary search. Conceptually, when searching for a number target in a list of numbers ...
joseville's user avatar
  • 486
1 vote
1 answer
54 views

Python Prime Search Slower Optimization

I have these 2 version of code. Both are looking for all primes under a certain ceiling value. The first is testing against the set of all odd numbers. The second in testing against the set of all 6k-...
Desmond Rhodes's user avatar
2 votes
2 answers
437 views

Searching database of books

The application I'm making a small app (currently ~500 lines) to manage and download books and other media items. Each item is uniquely identify by its ...
ChocolateOverflow's user avatar
3 votes
1 answer
68 views

Brute-force electronic component selection space search

Yesterday I hacked up a simple component selection program. An example is shown at the bottom for the application, though this can be used generally for a lot of different simple circuits I come ...
Reinderien's user avatar
  • 65.2k
3 votes
1 answer
836 views

Elegant Method for Sleeping with Selenium Webscraper

My goal is to scrape the no. 1 suggestion of the suggestion list on https://finance.yahoo.com for any entry. If there is no suggestion the code should write ...
MaGarb's user avatar
  • 43
4 votes
2 answers
105 views

Search engine that looks through files

For my programming class, at the start of the semester before we learned about object oriented coding, I was supposed to make a small program that searches through a bunch of files, being graded on ...
user avatar
2 votes
0 answers
2k views

C++ implementation of Monte Carlo Tree Search with Python wrapper

Important Prebuilt Python Extensions built for Python 3.6 Includes Python f-strings (3.6+) Complementary GitHub link https://github.com/thejhonnyguy/CPyMCTS Notable: Previous attempt with stock ...
Luke's user avatar
  • 501
12 votes
5 answers
2k views

Find all words that satisfy unknown letters (Hangman)

I have been working on a function which might be used to solve a word game like Hangman or "Wheel of Fortune". Basically, I wish to search from a very large ...
Al Longley's user avatar
1 vote
1 answer
918 views

Searching for column-indices of a multi-dimensional array that match multiple conditions (one condition per row)

I have written a script that I believe works and covers all edge-cases. I am curious about ways to improve upon speed. While the given example below covers a multi-dimensional array of ...
user avatar
7 votes
2 answers
1k views

Nearest Neighbor Algorithm (general nearest, forward-nearest, or backward-nearest)

I am trying to write an algorithm that can find user-specified nearest neighbors. By user-specified, I mean that the user can specify whether it's a general nearest neighbor, a forward-nearest ...
user avatar
1 vote
2 answers
119 views

Search a unique list and search a larger list to set dictionary with keys of binary values

I would like to search a list of unique values and create a dictionary with those unique values as keys, and a binary list for whether those values occur. I have successfully solved this, but would ...
Christopher Goings's user avatar
4 votes
1 answer
4k views

Filtering parent and children elements of list of dictionaries

I have a list of dictionaries and its elements has id and parent_id fields. Main purposes: If the parent_id field of an element is defined, it should be returning the rest of elements except itself. ...
vildhjarta's user avatar
2 votes
1 answer
98 views

Which is the best approach for searching the dictionary items?

We can search for the list of dictionaries using the below some approaches, Can one please help me, which one is the memory efficient approach to use? Provided that: ...
Laxmikant's user avatar
  • 123
5 votes
1 answer
124 views

Selecting site to browse in python

This code is for part of my first major contribution to open-source, for the socli project. The purpose is to allow the user to select a site from the stack exchange network to browse and fill two ...
auden's user avatar
  • 431
8 votes
1 answer
15k views

A* Search on 'Map of Romania' (Russel and Norvig ch3) in Python 3

I've implemented A* search using Python 3 in order to find the shortest path from 'Arad' to 'Bucharest'. The graph is the map of Romania as found in chapter 3 of the book: "Artificial Intelligence: A ...
Ramiz Rahman's user avatar
5 votes
1 answer
8k views

Python 3 - Get n greatest elements in dictionary

Given an dictionary with lists as values this piece of code is dedicated to find the n keys with the longest lists as values. It works, but there has to be a more elegant solution. ...
user7802048's user avatar
5 votes
2 answers
134 views

Creates a class that searches for the elements in a list that contain a sequence

Not sure what I should write here. The code should be self-explanatory. ...
mikeLundquist's user avatar
2 votes
1 answer
106 views

File search program not efficient enough

I have created a program to search for a file in the computer. But I feel it can be improved. Can anyone help me with this? filesearch.py ...
Vin's user avatar
  • 185
10 votes
3 answers
617 views

Read file with over 300k words and filter through appropriate filter to return list of matching words

As a puzzle we were asked to bring out the possibilities in breaking a 4 letter wordlock combination. It was to be a four letter word from the English dictionary. There were 10 possible characters in ...
mobcity zkore's user avatar
1 vote
2 answers
3k views

Python Search file for string and read into list

This function of my program is searching a file that is formatted as first_name last_name rate hours: John Smith 25 80 Mary Johnson 15.5 60.0 ... With one space ...
ByteSettlement's user avatar
8 votes
1 answer
2k views

Fuzzy / approximate text matching program in Python

I'm trying to build a program that will find approximate text matches between two texts. Basically, I'd like to find a way of identifying quotations, so that when an author quotes, say, the King James ...
Jonathan's user avatar
  • 173
2 votes
3 answers
336 views

Finding Egyptian fractions with A* search

I've written an A* search to find the optimal solution to the equation $$ \dfrac{4}{n} = \dfrac{1}{x} + \dfrac{1}{y} + \dfrac{1}{z} $$ with \$n, x, y, z\$ positive integers, and \$n\$ given; the ...
Pavlin's user avatar
  • 163
6 votes
2 answers
265 views

Searching for files in a specified directory

I am currently writing a program that allows me to search for files in a user-specified directory. My current code is as follows: ...
user3233949's user avatar