ByteByteGo 2024年10月05日
EP132: Big O Notation 101: The Secret to Writing Efficient Algorithms
index_new5.html
../../../zaker_core/zaker_tpl_static/wap/tpl_guoji1.html

 

文章涵盖了多个技术主题,包括算法效率的Big O Notation、Next.js应用的监控、认证机制、DDD的关键概念、NoSQL数据库的使用案例以及产品推广等内容。

🎯Big O Notation:介绍了从简单到复杂的多种时间复杂度表示法,如O(1)、O(n)、O(log n)等,并举例说明其应用场景。

📱Next.js应用监控:讲解如何使用新的App Router为Next.js应用设置服务器端的应用性能监控和前端的浏览器监控,实现全栈可观测性。

🔐认证机制:阐述了SSH Keys、OAuth Tokens、SSL Certificates、Credentials这四种认证机制的作用和用途。

🎓DDD的关键概念:包括通过领域建模驱动软件设计、统一语言、业务实体、模型边界、聚合、实体与值对象的区别、操作建模、架构分层以及构建领域模型。

💾NoSQL数据库使用案例:列举了MongoDB、Cassandra、Redis等9种NoSQL数据库在不同领域的应用优势和特点。

This week’s system design refresher:


Free tickets to P99 CONF - 60+ low-latency engineering talks (Sponsored)

P99 CONF is the technical conference for anyone who obsesses over high-performance, low-latency applications. Naturally, Rust is a core topic.

How is Rust being applied to solve today’s low latency challenges – and where it could be heading next? That’s what experts like Carl Lerche (Tokio creator, Rust contributor) and Ashley Williams (Rust core team, Rust Foundation founder) will be exploring.

Join 20K of your peers for an unprecedented opportunity to learn from engineers from Disney, Shopify, LinkedIn, Netflix, Google, Meta, Uber + more – for free, from anywhere.

GET YOUR FREE TICKET

Bonus: Registrants get 30-day free access to the complete O’Reilly library and a chance to win 1 of 500 swag packs!


Big O Notation 101: The Secret to Writing Efficient Algorithms

From simple array operations to complex sorting algorithms, understanding the Big O Notation is critical for building high-performance software solutions.

    O(1)
    This is the constant time notation. The runtime remains steady regardless of input size. For example, accessing an element in an array by index and inserting/deleting an element in a hash table.

    O(n)
    Linear time notation. The runtime grows in direct proportion to the input size. For example, finding the max or min element in an unsorted array.

    O(log n)
    Logarithmic time notation. The runtime increases slowly as the input grows. For example, a binary search on a sorted array and operations on balanced binary search trees.

    O(n^2)
    Quadratic time notation. The runtime grows exponentially with input size. For example, simple sorting algorithms like bubble sort, insertion sort, and selection sort.

    O(n^3)
    Cubic time notation. The runtime escalates rapidly as the input size increases. For example, multiplying two dense matrices using the naive algorithm.

    O(n logn)
    Linearithmic time notation. This is a blend of linear and logarithmic growth. For example, efficient sorting algorithms like merge sort, quick sort, and heap sort

    O(2^n)
    Exponential time notation. The runtime doubles with each new input element. For example, recursive algorithms solve problems by dividing them into multiple subproblems.

    O(n!)
    Factorial time notation. Runtime skyrockets with input size. For example, permutation-generation problems.

    O(sqrt(n))
    Square root time notation. Runtime increases relative to the input’s square root. For example, searching within a range such as the Sieve of Eratosthenes for finding all primes up to n.

Over to you: What else will you add to better understand the Big O Notation?


How to monitor a Next.js application with app-based router (Sponsored)

Next.js is a powerful JavaScript framework that offers optimized speed and performance for both development and runtime. In this blog post, you’ll learn how to set up application performance monitoring for the server side and browser monitoring for the frontend using the new App Router, giving you full-stack observability in your Next.js application. 

Get started for free


Top 4 Forms of Authentication Mechanisms

    SSH Keys:
    Cryptographic keys are used to access remote systems and servers securely

    OAuth Tokens:
    Tokens that provide limited access to user data on third-party applications

    SSL Certificates:
    Digital certificates ensure secure and encrypted communication between servers and clients

    Credentials:
    User authentication information is used to verify and grant access to various systems and services

Over to you: How do you manage those security keys? Is it a good idea to put them in a GitHub repository?


8 Key Concepts in DDD


Top 9 NoSQL Database Use Cases

Different databases excel in different areas and it’s important to choose the right database for the requirement.

    MongoDB (Document Store)
    Used for content management systems and catalog management. Features BSON format, schema-less design, supports horizontal scaling with sharding, and high availability with replication

    Cassandra (Wide-column Store)
    Ideal for time-series data management and recommendation engines. Offers wide-column format, distributed architecture, and CQL for SQL-like querying.

    Redis (Key-Value Store)
    Suited for Cache, Session Management, and Gaming Leaderboards. Provides in-memory storage, support for complex data structures, and persistence options with RDB and AOF.

    Couchbase (Document Store with Key-Value)
    Used for content management systems and e-commerce platforms. Combines key-value and document-based operations with memory-first architecture and cross-data center replication.

    Neo4j (Graph DB)
    Excellent for social networking and fraud detection. Features ACID compliance, index-free adjacency, Cypher Query Language, and HA cluster capabilities.

    Amazon DynamoDB (Key-Value and Document)
    Perfect for serverless and IoT applications. Supports both key-value and complex document data, managed by AWS, with features like partition data across nodes and DynamoDB streams.

    Apache Hbase (Wide-Column Store)
    Used for data warehouse and large-scale data processing. Modeled after Google’s Bigtable, offers Hadoop integration, auto-sharding, strong consistency, and region servers.

    Elasticsearch (Search Engine)
    Ideal for full-text search and log and event data analysis. Built on Apache Lucene, document-oriented, with sharding and replication capabilities, and a RESTful interface.

    CouchDB (Document Store)
    Suitable for mobile applications and CMS. Document-oriented, ensures data consistency without locking, supports eventual consistency, and uses a RESTful API.

Over to you: Which other NoSQL database would you add to the list?


SPONSOR US

Get your product in front of more than 1,000,000 tech professionals.

Our newsletter puts your products and services directly in front of an audience that matters - hundreds of thousands of engineering leaders and senior engineers - who have influence over significant tech decisions and big purchases.

Space Fills Up Fast - Reserve Today

Ad spots typically sell out about 4 weeks in advance. To ensure your ad reaches this influential audience, reserve your space now by emailing sponsorship@bytebytego.com

Fish AI Reader

Fish AI Reader

AI辅助创作,多种专业模板,深度分析,高质量内容生成。从观点提取到深度思考,FishAI为您提供全方位的创作支持。新版本引入自定义参数,让您的创作更加个性化和精准。

FishAI

FishAI

鱼阅,AI 时代的下一个智能信息助手,助你摆脱信息焦虑

联系邮箱 441953276@qq.com

相关标签

Big O Notation Next.js 认证机制 DDD NoSQL数据库
相关文章