#binary search algorithm
Explore tagged Tumblr posts
Text
Navigating Efficiency: A Comprehensive Guide to the Binary Search Algorithm
In the vast landscape of algorithms, one star shines bright in the realm of search operations—Binary Search. This comprehensive guide aims to demystify the intricacies of this algorithm, exploring not only its mechanics but also delving into the crucial aspect of time complexity. Join us on a journey to unlock the power of efficiency.
Understanding Binary Search:
Binary Search Demystified:
Imagine you have a library of books neatly arranged in alphabetical order. Binary search is like finding a specific book by repeatedly splitting the remaining possibilities in half. You start in the middle, decide if the target is in the left or right half, and continue this process until you've pinpointed the book. This systematic approach is the heartbeat of binary search.
Real-World Scenario:
Consider a scenario where you're searching for a friend in a phone book. You open it in the middle, decide whether their name would be in the first or second half, and repeat until you locate the right entry. This mirrors the efficiency of binary search in swiftly finding elements in a sorted collection.
Time Complexity Unveiled:
The Essence of Time Complexity:
Now, let's dive into the critical realm of time complexity. Binary search boasts a time complexity of O(log n), where n is the number of elements. To put it simply, as your dataset grows, binary search's efficiency doesn't increase at the same pace as linear search, making it a go-to solution for large datasets.
Visualizing Time Complexity:
Picture a scenario where you're searching for a specific contact in your phone—a linear search would involve scrolling through each entry, while binary search mirrors the efficiency of quickly narrowing down your contacts by jumping to the middle, then deciding which half to explore.
Real-Life Applications:
Binary Search in Everyday Scenarios:
Consider managing an extensive contact list on your phone, sorted by names. Binary search becomes your ally in swiftly locating a friend's contact information without scrolling through every entry. This efficiency becomes even more pronounced in scenarios like online databases or searching for elements in a sorted array.
Optimizing Database Queries:
In the realm of databases, where time is of the essence, binary search becomes a game-changer. Whether you're searching for a specific record by ID or querying a sorted dataset for relevant information, the algorithm's efficiency enhances response times and user experience.
Conclusion:
As we conclude our exploration of the Binary Search Algorithm, it stands as a beacon of efficiency in the sea of algorithms. Its simplicity, coupled with the elegance of divide and conquer, makes it a valuable asset in the toolbox of any programmer or data scientist.
Armed with the knowledge of binary search and its time complexity advantages, you're empowered to optimize search operations and enhance the responsiveness of your applications. In the dynamic world of technology, where speed and efficiency are paramount, understanding the nuances of binary search opens doors to a realm of possibilities, making your journey through the vast data landscape smoother and more rewarding.
Know more: Click Here
0 notes
Text
Grokking Algorithms #1
I’m awful at algorithms. There, I said it. I could blame my college algorithms professor or the fact that I’ve never had to use fancy algorithms at work. But anytime I’m on the market for a new job, I’m confronted with the inevitable HackerRank or LeetCode challenge and I stumble, remembering my biggest weakness as a software engineer. Now that I’m happy with my current job, I figure it’s a…

View On WordPress
2 notes
·
View notes
Text
C++ / algoritmo de busqueda binaria
Hoy les traigo otro algoritmo de busqueda pero con otra manera de trabajar. Espero les sea de utilidad!
Bienvenidos sean a este post, hoy veremos otra forma de busqueda. En el post anterior vimos como crear un algoritmo de busqueda simple con iteradores para hacerlo completamente generico. La busqueda binaria puede ser mas simple que el visto anteriorrmente. Esto es asi porque el primer elemento que mira sera el de la mitad del contenedor. Si el elemento coincide con el que buscamos procede a…
0 notes
Text
youtube
1 note
·
View note
Text
OpenAI GPTs: Building Your Own ChatGPT-Powered Conversational AI
New Post has been published on https://thedigitalinsider.com/openai-gpts-building-your-own-chatgpt-powered-conversational-ai/
OpenAI GPTs: Building Your Own ChatGPT-Powered Conversational AI
What are GPTs?
GPTs, introduced by OpenAI in November 2023, are customizable versions of the ChatGPT model. They represent a significant shift from general-purpose AI chatbots to specialized, purpose-driven AI assistants. GPTs can be tailored for specific tasks, making them more effective and efficient in various domains, from education and gaming to business and creative arts.
OpenAI new GPT Builder (GPTs)
Key Features and Capabilities
Customization Without Coding: One of the most groundbreaking aspects of GPTs is that they require no coding skills to build. This makes it accessible to a broader audience.
Wide Range of Applications: GPTs can be designed for myriad uses, such as teaching math, assisting in game rules interpretation, or creating digital content like stickers.
Integration of Extra Knowledge: Users can feed additional information into GPTs, enhancing their ability to handle specialized tasks.
Functional Flexibility: GPTs can incorporate capabilities like web searching, image creation, and data analysis, depending on the user’s needs.
Creating a Custom GPT: Simplicity and Efficiency
Creating your personalized GPT app is a straightforward process that requires no coding knowledge, making it accessible for anyone with an idea. Here’s a simplified guide on how to bring your custom GPT to life:
Step-by-Step Guide to Creating Your Personalized GPTs App
Login and Navigate: First, log into your ChatGPT account. Look for the “Explore” section, which is usually located on the top left of your screen. This is where you’ll find all the GPT applications you have access to.
OpenAI ChatGPT
Create Your GPT: Click on ‘Create My GPT’. You’ll be taken to a new screen. Here, you’ll be prompted to describe what your GPT should do.
GPTs Interface
Set Your Prompt: Input your prompt with clarity and purpose. For our example we created a “Code Mentor” by entering a prompt: “Create an AI that provides clear explanations and guides users through algorithms and data structures, capable of facilitating real-time problem-solving sessions.”
Building a Coding Mentor with GPTs
Refinement: ChatGPT may ask follow-up questions to refine your concept. This step ensures your GPT is aligned with your vision and is capable of performing its intended functions efficiently.
Testing and Customization: Once created, your GPT appears on the right side of the screen. Here you can test its capabilities and fine-tune its functions. For the “Code Mentor” you might test it with queries like “Explain the concept of dynamic programming” or “Guide me through implementing a binary search tree.”
Save and Share: After you’re satisfied with your GPT, you can save your settings. Then, take advantage of the option to share your GPT with others. This is done through a link, making collaboration easy and promoting a community-oriented approach to AI development.
Remember, while Plus users have immediate access to use the GPTs via shared links, the creators won’t have access to the chats others have with their GPTs,.
Open AI mentioned that Privacy and safety are at the heart of GPTs. Chats with GPTs remain private, not shared with builders, and users have full control over whether data is sent to third-party APIs. Additionally, builders can decide if interactions with their GPT should contribute to model training, giving users and builders alike control over data usage and privacy.
Connecting GPTs to Real-World Applications
Beyond explanations, these GPTs can connect to external data sources or perform actions in the real-world. For instance, you could create a “Shopping Assistant” GPT that helps with e-commerce orders, or a “Travel Planner” GPT that integrates with a travel listings database.
Empowering Enterprises with Custom GPTs
Enterprises can take advantage of internal-only GPTs for specific use cases. This could range from a “Marketing Assistant” that helps draft brand-aligned materials to a “Support Helper” that aids in customer service. These GPTs can be deployed securely within a company’s workspace, with full administrative control over sharing and external GPT usage.
5 custom GPT applications that users have created
Conclusion
The evolution of AI technology with OpenAI’s GPT-4 Turbo and the introduction of customizable GPTs represent a significant leap forward in the field of artificial intelligence. GPT-4 Turbo’s enhanced context window and integration with visual and auditory capabilities mark a new era of conversational AI that is more accurate, detailed, and versatile. The GPTs, with their user-friendly customization options, open up endless possibilities for personal and professional use, democratizing AI technology and making it accessible to a wider audience.
#2023#ai#AI Tools 101#Algorithms#Analysis#APIs#app#applications#approach#artificial#Artificial Intelligence#Arts#binary#Binary Search#Binary Search Tree#Building#Business#chatbot#chatbots#chatGPT#code#coding#Collaboration#Commerce#Community#conversational ai#creators#customer service#dall-e#data
0 notes
Text
It’s actually really sad that the police didn’t listen for a way to do their job better.
Then again, it’s the police, so i’m not that surprised.
God-tier account of a Cambridge computer scientist trying to get police to investigate his bike theft camera footage:

33K notes
·
View notes
Text
do you really wanna let an ALGORITHM perform binary search on your tree??
323 notes
·
View notes
Text
I really don't know how Tumblr's search manages to be this bad.
Like, I know I have at least 5 posts mentioning FOOBAR (FOOBAR here is a placeholder word).
Tumblr finds 2 of them.
I can totally see how you might have a search engine that doesn't find any of them, but only finding some of them? How?
Are you trying to do an evolutionary algorithm crossed with a chaos monkey where you randomly delete entries from your full text index, figuring that 99% of posts will never be searched for?
Because computers are usually binary! They work or they don't. This half-working is so strange that I can only imagine how Tumblr got it this twisted.
313 notes
·
View notes
Text

"One of the most persistent and sticky habits of perception that has possessed those of us gestated in modern civilizations is: we tend to see things as separate from each other; we see things as bounded and atomized.
I see the strategy of separation as an attempt to create safety, permanence, fixity, for once and for all, to name things in a final way. That’s the modern impulse. But you run into trouble when things like what’s happening today start to crop up.
We are slowly coming to terms with a world that is more entangling, more relational, and more processual than our modern habits of seeing can allow us to notice or appreciate.
We are not so different from our technologies as modernity would have us believe we are. In shaping computers, we are shaped by computers. In participating in networks, we are conducting and performing emotional labor and shaping ourselves.
It means that we think, act, behave, see, want, yearn, practice, perform, and do things with the world and with others. The presumption that we act as individuals is already being haunted by the idea of an entangled world.
My work in thinking about climate change through the prism of Indigenous realities, poetry, and entanglement, is basically to note that we need to find the places of power with which we might respond to something that is beyond us. We are responding in the machine, and the machine is tired and exhausted.
Slowing down is not a function of speed. It is a function of awareness, and I don’t want to make awareness a mental construct. It’s a function of presence.
So, when I invite slowing down, I invite us to research and to perform research into the ancestral tentacularities that precede us. I’m asking us to touch our bodies, and touch our colonial bubbles.
I’m asking us to listen, to witness, to ‘with-ness’; to be with land, and community, and ancestor, and progeny, and children in a way that isn’t instrumental.
Activism is increasingly instrumental, meaning it’s a form of power that is tied to the logic and algorithm of the status quo. This makes activism, even in the search for justice, a creature of the status quo, which renders hope and justice, as ironic as that sounds, a creature of the things we’re trying to leave behind.
To slow down is to hack the machine, like we’re taking on other forms of body that allow us to penetrate into different kinds of realities—other worlds.
What if rest is listening to one’s Elders? What if rest is dreaming? What if working is playing?
The university structure is one example of a colonial imposition that sees study and learning as only one thing; university tells you that if you’re not studying in some disciplinary manner, then you’re not studying. But what if having a conversation with a friend is a form of study?
Rest is decolonial in its relational entanglements with a capitalist structure. I don’t want to see it as a binary thing: rest vs. non-rest. I want to move outside that binary altogether, and create fugitive communities where rest takes on new meanings altogether. I don’t know what that is—only in the performance of it can we speak about it, and that’s just fine."
~ Bayo Akomolafe
Text source: Dr. Bayo Akomolafe on Slowing Down in Urgent Times https://atmos.earth/dr-bayo-akomolafe-on-slowing-down-in-urgent-times/
22 notes
·
View notes
Text
one of the best sorting algorithm though has to be the denial sorting algorithm (O(0) space & time): first, shuffle the list...
And... Now it's sorted ! no no, I swear it's sorted. It just couldn't be not sorted. It's sorted. Don't worry about it. It's mostly- it's Completely sorted. From start to finish. Yeah 1, 5, 4, 2, 6, 9, 8, 3, 7, 0, just like we learned in school ! Now run you binary search or something on it, don't worry.
18 notes
·
View notes
Note

Why are there fences around the trees in all of the dramas? I know that there are better pictures but this was the only one I could directly find from memory.
I also use they/them pronouns. Have you talked about/would you be willing to talk about navigating the linguistics of a gendered language like Thai? ARE there really no neo pronouns outside the ค่ะ/ครับ binary? A lot of times actual queer lived experiences dont make it through the search engine algorithm no matter how hard you look for them.
Do you have a patreon/buy me a cup of coffee etc? I'm willing to tip for your labor. (Not much, sadly because I am very very poor, but still I appreciate anyone who is willing to help with translation/questions.) It can be frustrating when you are a self learner and there is literally no one tgat you can ask a question.
I think you're the first person to ask me this! It made me smile.
It's a sort of dual-faceted protection. Like other places, it's mostly to protect the soil from being trampled on so that it stays as porous as possible and can retain water (especially for newly planted trees). The more cultural reason is that certain trees hold auspicious and spiritual value to us, so we would want to preserve them by limiting disturbances (though most of those won't be found in urban environments). There's a big movement in certain cities to revitalize green spaces for both cultural and climate reasons.
As for your second question... I've spoken a little bit about gendered language in Thailand [X] The problem, for me, doesn't really exist in what you could call language 'norms'. Because pronouns/particles (ฉัน/ผม | ค่ะ/ครับ/จ๊ะ) are, more increasingly, used interchangeably OR what are classified as "female" pronouns can be used as 'acceptable' gender neutral identifiers. The problem is how certain people react to the use of gendered language in more modern expression. Does that make sense? Collectivist views and traditionalism look down upon non-adherence to gender correlated language, in a lot of instances. The fact that our culture was established from patriarchal perspectives doesn't help.
I don't know if I'm comfortable or ready to talk about my personal experiences (some of which were very unpleasant) living as a non-binary transgender person in Thailand, especially in online spaces, but I hope that I can get there one day.
Please don't feel pressured to compensate me in any way!!! I'm not asking or expecting to be rewarded for sharing my cultural insight. Some might see it as generous, and I'll accept that, but the reason behind it is very self-serving...in a way. Because I desperately want to combat the false information and discriminatory views that exist in fandom spaces about my culture. So really...
Thank you to anyone who refrains from making generalized assumptions about a culture that you do not belong to. It's hurtful to to see a lot of the misinformation that exists, not just here, but in other social media spaces. Coming to terms with interfandom has been a struggle... because Thai voices are often disregarded when discussing media that originates from their own country. And I hope that I've created an environment where you'd feel comfortable enough coming to me for any sort of clarification. All I have ever asked, is that you be respectful.
23 notes
·
View notes
Text
I used to go to the library sometimes and pick books off the return shelf and sort them using different sorting algorithms in O(n*log(n)) time and then put newly returned books back into the stack using binary search
21 notes
·
View notes
Text
It’s very funny to me that the earth kingdom avatar search method is literally just the binary search algorithm.
The airbenders rely on sentimentality that reaches back through the ages and the earthbenders use one of the first algorithms you learn how to code in comp sci 101
11 notes
·
View notes
Text
Strange way of drawing the Dragon Curve
Alright, so real quick I just want to share potentially the most arcane method of drawing the Dragon Curve I've ever seen, derived and designed by yours truly! As far as I know, this is a novel solution. I know the sequence it generates is known, but I'm not sure if anyone else has used this method before. Its quite elegant if I may say so myself.
So for those that aren't aware in programming the "<<" and ">>" operators are sometimes known as "bit shifts." Basically what this is doing is starting at some number, adding a power of two, then getting a specific 1 or 0 in the binary representation of that number iteratively, until its searched enough bits to know they aren't going to change anymore.
It has to do with this sequence right here. I've mentioned before, my personal favorite way of generating the dragon curve is to start with the sequence 0, reverse it, add one, roll over once you reach 4, and tack that on to the original sequence. So 0 0 1 0 1 2 1 0 1 2 1 2 3 2 1 0 1 2 1 2 3 2 1 2 3 0 3 2 3 2 1 Well what ends up happening is each time you add one, its like adding one to the reversed part of the newly added sequence. So we can track where all these 1's come from based on when they're added. For example, the 1 we added in the "01" step turns into 0 1 0 1 1 0 0 1 1 0 0 1 1 0 Note from here on out its palindromic, so reversing it no longer has any effect. What we end up with is a repeating pattern of two 1's, then two 0's, starting with half that many 0's. When going from 0 1 0 1 2 1 We're adding 1's to the entire second half, so in this step the 1's propagate to 0 0 1 1 0 0 1 1 1 1 0 0 0 0 1 1 1 1 0 0 0 0 1 1 1 1 0 0 And again, this is now palindromic. Four 1's, four 0's led by half that many. One of the things I've learned about the dragon curve is just how intrinsically linked it is to binary (and this makes sense when you think of the folding paper method of generating it. Here's an excel spreadsheet demonstrating this in action
Now here's the fun part. My research was to parallelize this algorithm. One approach is to say "Okay, how can we calculate each term in this sequence without looking at the previous ones." And the answer is to exploit these very predictable patterns. And how do we predict these patterns? Simple, we simply count in binary
The right most column is useless, but starting at the next one to the left, we see a familiar pattern, almost. Say we want to know what the 5th number in the dragon curve sequence is (0 indexed). To make the sequence only lead with one 0 instead of two, we need to offset by 1, then all we have to do is increase the number by (n + 1) = 5 and take its 2nd least significant bit (1 indexed because english). The 2nd bit of ( 1 + 5 = 6 ) is a 1. For the next iteration we're looking at the 3rd least significant bit. Here we need to offset by 2, and then we increase the number by 5 again and the 3rd significant bit is the one we take. The 3rd bit of (2 + 5 = 7) is another 1 After that we're looking at the 4th least significant bit. We need to offset by 4, then increase the number by 5, and the 4th significant bit will give us our number. The 4th bit of (4 + 5 = 9) is going to be another 1, bringing our total to 3. Here's a visual representation
This is where the "1 << i" comes in, because that's the same as saying 2^i, which is how we get those offsets of 1, 2, 4, then 8, 16, 32... the "n" in "n + (1 << i)" comes from us offsetting to get the nth term in each sequence Finally the " >> (i + 1) " and "% 2" are to fetch the (i + 1)th bit from the number. After that the increasing size of the leading zero's outpaces our constant offset of the number 5, so we are only going to get 0's from here on out, and we can actually stop, hence the usage of bit length to terminate the loop early.
And if we look at the the 5th element of the sequence (0 indexed) 0 1 2 1 2 3 Funnily enough, in python this brings an actual speed increase (or at least, distributes the cost over the drawing) because of how slow reading and writing to memory is, compared to how math and bit-wise operations are implemented in low level C behind the scenes. Additionally, since there is no reliance on previous work this task can be multi-threaded, or even GPU accelerated if need be. Finally, if you've made it this far, here are a few images of some close ups of dragon curves from my GPU implemented (unrelated to this one entirely) just so that there's something pretty. Enjoy <3
#Dragon curve#fractal#programming#progblr#codeblr#python#fractals#math#computer science#algorithms#binary
126 notes
·
View notes
Note
Dunno if someone asked you this, but what inspired you to create Well Abridge Me, Princess in the first place?
God okay, long answer
well my YouTube had started tanking
which was an emergency when I lived in the most expensive part of the US
but kind of a blessing in disguise when I moved to a developing country and didn't need to make nearly as much money
because if the algorithm wouldn't promote anything I do anyway, then I literally have to make whatever I want
but as a people-pleaser who spent a lot of time in the closet, I didn’t fucking know would be the most Me thing ever
and after using voice acting as a tool to help millions with issues processing reading with Lost Legends, and working directly with Strong Bad on the podcast, I didn’t have any career goals left
so I did A LOT of soul-searching
every time I worked on a project, I paid attention to when I was having the most fun
In the Pirates of the Caribbean Real-Time Fandubs, I loved making my aesthetic and queer identity the centerpiece that everything else fell around
on Mystery Shack Lookback, I loved making jokes like Dog With A Pod that were basically only funny to me and Ella, and yet surprisingly not getting complaints like I would have on YouTube
when I made a Doremi Abridged One Shot for my wife's birthday, I was shocked I didn't get as bored editing as I usually do
and it became clear that my ideal project would be an Abridged Series based on a swashbuckling property in which I voice a non-binary character and/or a woman
and remembering how excited I sounded infodumping about Legend of Zelda in the PinesQuest podcast episode, there was an obvious answer
24 notes
·
View notes
Text
I was tagged by @nohoperadio for this meme about 10 books or categories-of-books you're planning to read this year... their list is full of Actual Literature and mine isn't going to be nearly as impressive, but here it is anyway...
So I use Goodreads (link - feel free to friend me) and have a gigantic to-read list, which I've tried to manage by breaking it up into various categories/genres, ordering each list according to an obscure algorithm and then rotating through the categories in an overly complicated system that changes every few months... but without some kind of system to tell me what to read next I think I would just be paralyzed by indecision because there are too many books that I want to read Right Now. But anyway that means my reading is pretty planned out and I do have a pretty good idea of what I'm going to be reading this year.
I read mostly SFF and one subgenre I've been very into lately is "stuff with interesting aliens" and one book that's currently near the top of that list is The Sparrow by Mary Doria Russell, which as I understand it is a book about aliens and religion, both topics that I'm interested in. So I'm looking forward to that one.
Another category which is sometimes a subgenre of the above is books (usually SF but occasionally fantasy) which depict a society that Does Gender Differently, especially in the sense of having some kind of non-binary gender system. Sometimes I become an insane completionist about things, and this is one of those things.... it's just fun seeing how many different tri-gender (or whatever) systems writers can come up with, even when the books themselves are otherwise terrible. I've now read most of the well-known stuff in this subgenre and have been venturing into the increasingly obscure... one that I'll probably get to this year is called Eifelheim by Michael Flynn, which apparently also involves both religious themes and aliens with three sexes? Hey, sign me up.
In the general category of "stuff by authors I like and want to read more of" some I've got coming up are Babel-17 by Samuel R. Delany, The Transmigration of Timothy Archer by Philip K. Dick, The Truth and Other Stories by Stanisław Lem, Rocannon's World by Ursula K. Le Guin.... also some more Asimov and Heinlein, which I'm a little embarrassed about as I have been given to understand that all Real SF Fans already read all that "golden age" stuff when they were 12 and haven't glanced at it since.
Also: more silly Sherlock Holmes fanfics pastiches, of which I've already read way too many. I usually go for the ones that bring in SFF elements (the crackier the better) or that sound like they might have h/c in them lol. Coming up in the near future is Lindsay Faye's Observations by Gaslight.
In the nonfiction category, the next on the list is Buddhisms: An Introduction by John S. Strong, which I picked out just by searching around for a good introductory book on the topic. That's how I tend to approach nonfiction reading, by starting with a general overview of whatever topic I'm interested in to get some background on the "scholarly consensus" before delving into books on more specific subtopics or scholars presenting their own idiosyncratic view or "bold new theory" or whatever. Mostly I've been reading about religion lately; I kind of want to get back into math and science stuff which I liked as a kid and did well at in school, but everything I learned is so rusty now... and I dunno, I like the idea of being the sort of person who actually understands relativity theory or whatever but realistically I'm probably not actually smart enough for it lol.
I guess that's roughly ten things. Tagging (only if they want to obviously) @ipsomaniac @paradigm-adrift and/or anyone else who feels like doing it.
5 notes
·
View notes